Re: [PATCH] Netlink patch.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Alok,

ext Alok wrote:
Hi Marcel,
Attaching a patch which implements a generic netlink command
GET_DEVLIST(HCIGETDEVLIST).

I don't know anything about netlink stuff but I'll give some generic comments :)


+	
+	if (info->attrs[NLBLUETOOTH_ATTR_DEVNUM]) {
+		dev_num = nla_get_u16(info->attrs[NLBLUETOOTH_ATTR_DEVNUM]);
+		if (!dev_num)
+			return -EINVAL;
+	} else
+		return -EINVAL;
+

I would prefer this kind code paths. Easier to read.

	if (!info->attrs[NLBLUETOOTH_ATTR_DEVNUM])
		return -EINVAL;

	dev_num = nla_get_u16(info->attrs[NLBLUETOOTH_ATTR_DEVNUM]);
	if (!dev_num)
		return -EINVAL;

+	msg = nlmsg_new(NLMSG_GOODSIZE, GFP_KERNEL);
+
+	if (!msg)
+		return -ENOBUFS;
+
+	hdr = genlmsg_put(msg, 0, info->snd_seq+1, &nlbluetooth_fam, 0, NLBLUETOOTH_CMD_GET_DEVLIST);
+
+	if (hdr == NULL)
+		return -ENOMEM;

Is msg left unfreed here?

+
+	nl_list = nla_nest_start(msg, NLBLUETOOTH_ATTR_DEVLIST);
+	if (!nl_list)
+		goto nla_put_failure;

And here? I cannot find skb_free or friends from genlmsg_cancel() path.


--
Ville

--
To unsubscribe from this list: send the line "unsubscribe linux-bluetooth" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Bluez Devel]     [Linux Wireless Networking]     [Linux Wireless Personal Area Networking]     [Linux ATH6KL]     [Linux USB Devel]     [Linux Media Drivers]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Big List of Linux Books]

  Powered by Linux