genetlink: Fix uninitialized variable in genl_validate_assign_mc_groups()
authorGeert Uytterhoeven <geert@linux-m68k.org>
Sat, 23 Nov 2013 12:01:50 +0000 (13:01 +0100)
committerDavid S. Miller <davem@davemloft.net>
Thu, 28 Nov 2013 23:24:07 +0000 (18:24 -0500)
net/netlink/genetlink.c: In function ‘genl_validate_assign_mc_groups’:
net/netlink/genetlink.c:217: warning: ‘err’ may be used uninitialized in this
function

Commit 2a94fe48f32ccf7321450a2cc07f2b724a444e5b ("genetlink: make multicast
groups const, prevent abuse") split genl_register_mc_group() in multiple
functions, but dropped the initialization of err.

Initialize err to zero to fix this.

Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/netlink/genetlink.c

index 4518a57aa5febb14db1c1d750f217102dd8fd2a9..803206e82450d47c87ebbc4d7b7c85f7999048d5 100644 (file)
@@ -214,7 +214,7 @@ static int genl_validate_assign_mc_groups(struct genl_family *family)
 {
        int first_id;
        int n_groups = family->n_mcgrps;
-       int err, i;
+       int err = 0, i;
        bool groups_allocated = false;
 
        if (!n_groups)