Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 856c52a7 authored by Dotan Barak's avatar Dotan Barak Committed by Roland Dreier
Browse files

IB/core: Take sizeof the correct pointer when calling kmalloc()



When allocating out_mad in show_pma_counter(), take sizeof *out_mad
instead of sizeof *in_mad.  It is true that today the type of in_mad
and out_mad are the same, but this patch will give us a cleaner code.

Signed-off-by: default avatarDotan Barak <dotanb@mellanox.co.il>
Signed-off-by: default avatarRoland Dreier <rolandd@cisco.com>
parent f72d2f08
Loading
Loading
Loading
Loading
+1 −1
Original line number Original line Diff line number Diff line
@@ -311,7 +311,7 @@ static ssize_t show_pma_counter(struct ib_port *p, struct port_attribute *attr,
		return sprintf(buf, "N/A (no PMA)\n");
		return sprintf(buf, "N/A (no PMA)\n");


	in_mad  = kzalloc(sizeof *in_mad, GFP_KERNEL);
	in_mad  = kzalloc(sizeof *in_mad, GFP_KERNEL);
	out_mad = kmalloc(sizeof *in_mad, GFP_KERNEL);
	out_mad = kmalloc(sizeof *out_mad, GFP_KERNEL);
	if (!in_mad || !out_mad) {
	if (!in_mad || !out_mad) {
		ret = -ENOMEM;
		ret = -ENOMEM;
		goto out;
		goto out;