Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 9fd40c5a authored by Geert Uytterhoeven's avatar Geert Uytterhoeven Committed by J. Bruce Fields
Browse files

SUNRPC: Refactor gssx_dec_option_array() to kill uninitialized warning



net/sunrpc/auth_gss/gss_rpc_xdr.c: In function ‘gssx_dec_option_array’:
net/sunrpc/auth_gss/gss_rpc_xdr.c:258: warning: ‘creds’ may be used uninitialized in this function

Return early if count is zero, to make it clearer to the compiler (and the
casual reviewer) that no more processing is done.

Signed-off-by: default avatarGeert Uytterhoeven <geert@linux-m68k.org>
Signed-off-by: default avatarJ. Bruce Fields <bfields@redhat.com>
parent 9f415eb2
Loading
Loading
Loading
Loading
+17 −15
Original line number Diff line number Diff line
@@ -264,7 +264,9 @@ static int gssx_dec_option_array(struct xdr_stream *xdr,
	if (unlikely(p == NULL))
		return -ENOSPC;
	count = be32_to_cpup(p++);
	if (count != 0) {
	if (!count)
		return 0;

	/* we recognize only 1 currently: CREDS_VALUE */
	oa->count = 1;

@@ -282,7 +284,7 @@ static int gssx_dec_option_array(struct xdr_stream *xdr,
	oa->data[0].option.len = sizeof(CREDS_VALUE);
	oa->data[0].value.data = (void *)creds;
	oa->data[0].value.len = 0;
	}

	for (i = 0; i < count; i++) {
		gssx_buffer dummy = { 0, NULL };
		u32 length;