linux-bluetooth.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] Netlink patch.
@ 2008-11-06 13:50 Alok
  2008-11-06 14:44 ` Ville Tervo
  0 siblings, 1 reply; 3+ messages in thread
From: Alok @ 2008-11-06 13:50 UTC (permalink / raw)
  To: linux-bluetooth

[-- Attachment #1: Type: text/plain, Size: 362 bytes --]

Hi Marcel, 

Attaching a patch which implements a generic netlink command
GET_DEVLIST(HCIGETDEVLIST). 
 
1. Will the netlink plugin expose an API like 
int hci_get_devlist(struct hci_dev_list_req *dl) ? 

2. If netlink registration fails would we fallback to raw sockets in the
plugin ?

Let me know if anything in the patch needs modification. 

Thanks, 
Alok.

[-- Attachment #2: 0001-Adding-netlink-support-to-bluetooth.patch --]
[-- Type: application/mbox, Size: 6005 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] Netlink patch.
  2008-11-06 13:50 [PATCH] Netlink patch Alok
@ 2008-11-06 14:44 ` Ville Tervo
  2008-11-07  6:47   ` [PATCH] Netlink patch.(modified) Alok
  0 siblings, 1 reply; 3+ messages in thread
From: Ville Tervo @ 2008-11-06 14:44 UTC (permalink / raw)
  To: ext Alok; +Cc: linux-bluetooth

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


^ permalink raw reply	[flat|nested] 3+ messages in thread

* [PATCH] Netlink patch.(modified)
  2008-11-06 14:44 ` Ville Tervo
@ 2008-11-07  6:47   ` Alok
  0 siblings, 0 replies; 3+ messages in thread
From: Alok @ 2008-11-07  6:47 UTC (permalink / raw)
  To: linux-bluetooth

[-- Attachment #1: Type: text/plain, Size: 120 bytes --]

Hi Marcel,

Attaching a modified netlink patch.
Forgot to free the buffer :) Thanks to ville for spotting it. 

-Alok. 

[-- Attachment #2: 0001-Adding-netlink-support-to-bluetooth.patch --]
[-- Type: application/mbox, Size: 5978 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2008-11-07  6:47 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-11-06 13:50 [PATCH] Netlink patch Alok
2008-11-06 14:44 ` Ville Tervo
2008-11-07  6:47   ` [PATCH] Netlink patch.(modified) Alok

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).