IB/core: Take sizeof the correct pointer when calling kmalloc()
authorDotan Barak <dotanb@dev.mellanox.co.il>
Tue, 10 Jul 2007 13:55:57 +0000 (16:55 +0300)
committerRoland Dreier <rolandd@cisco.com>
Tue, 10 Jul 2007 18:04:40 +0000 (11:04 -0700)
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: Dotan Barak <dotanb@mellanox.co.il>
Signed-off-by: Roland Dreier <rolandd@cisco.com>
drivers/infiniband/core/sysfs.c

index 08c299ebf4a8b5da88872c9116782ce5dd91c3ec..6265a3fee076d8a4158b5b84aeffa3379a332abb 100644 (file)
@@ -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");
 
        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) {
                ret = -ENOMEM;
                goto out;