diff options
-rw-r--r-- | drivers/w1/w1_netlink.c | 25 |
1 files changed, 13 insertions, 12 deletions
diff --git a/drivers/w1/w1_netlink.c b/drivers/w1/w1_netlink.c index 40788c925d1c..73705aff53cb 100644 --- a/drivers/w1/w1_netlink.c +++ b/drivers/w1/w1_netlink.c | |||
@@ -54,28 +54,29 @@ static void w1_send_slave(struct w1_master *dev, u64 rn) | |||
54 | struct w1_netlink_msg *hdr = (struct w1_netlink_msg *)(msg + 1); | 54 | struct w1_netlink_msg *hdr = (struct w1_netlink_msg *)(msg + 1); |
55 | struct w1_netlink_cmd *cmd = (struct w1_netlink_cmd *)(hdr + 1); | 55 | struct w1_netlink_cmd *cmd = (struct w1_netlink_cmd *)(hdr + 1); |
56 | int avail; | 56 | int avail; |
57 | u64 *data; | ||
57 | 58 | ||
58 | /* update kernel slave list */ | 59 | /* update kernel slave list */ |
59 | w1_slave_found(dev, rn); | 60 | w1_slave_found(dev, rn); |
60 | 61 | ||
61 | avail = dev->priv_size - cmd->len; | 62 | avail = dev->priv_size - cmd->len; |
62 | 63 | ||
63 | if (avail > 8) { | 64 | if (avail < 8) { |
64 | u64 *data = (void *)(cmd + 1) + cmd->len; | 65 | msg->ack++; |
66 | cn_netlink_send(msg, 0, GFP_KERNEL); | ||
65 | 67 | ||
66 | *data = rn; | 68 | msg->len = sizeof(struct w1_netlink_msg) + |
67 | cmd->len += 8; | 69 | sizeof(struct w1_netlink_cmd); |
68 | hdr->len += 8; | 70 | hdr->len = sizeof(struct w1_netlink_cmd); |
69 | msg->len += 8; | 71 | cmd->len = 0; |
70 | return; | ||
71 | } | 72 | } |
72 | 73 | ||
73 | msg->ack++; | 74 | data = (void *)(cmd + 1) + cmd->len; |
74 | cn_netlink_send(msg, 0, GFP_KERNEL); | ||
75 | 75 | ||
76 | msg->len = sizeof(struct w1_netlink_msg) + sizeof(struct w1_netlink_cmd); | 76 | *data = rn; |
77 | hdr->len = sizeof(struct w1_netlink_cmd); | 77 | cmd->len += 8; |
78 | cmd->len = 0; | 78 | hdr->len += 8; |
79 | msg->len += 8; | ||
79 | } | 80 | } |
80 | 81 | ||
81 | static int w1_process_search_command(struct w1_master *dev, struct cn_msg *msg, | 82 | static int w1_process_search_command(struct w1_master *dev, struct cn_msg *msg, |