genetlink: Fix uninitialized variable in genl_validate_assign_mc_groups()

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 2a94fe48f3 ("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>
This commit is contained in:
Geert Uytterhoeven 2013-11-23 13:01:50 +01:00 committed by David S. Miller
parent a2f4dfba9e
commit 0f0e2159c0

View File

@ -214,7 +214,7 @@ static int genl_validate_assign_mc_groups(struct genl_family *family)
{ {
int first_id; int first_id;
int n_groups = family->n_mcgrps; int n_groups = family->n_mcgrps;
int err, i; int err = 0, i;
bool groups_allocated = false; bool groups_allocated = false;
if (!n_groups) if (!n_groups)