Re: [PATCH] rxrpc: Fix uninitialized error code in rxrpc_send_data_packet()
From: Geert Uytterhoeven
Date: Tue Jun 04 2019 - 03:21:30 EST
On Fri, May 31, 2019 at 12:35 PM David Howells <dhowells@xxxxxxxxxx> wrote:
> Here's my take on the patch.
> rxrpc: Fix uninitialized error code in rxrpc_send_data_packet()
> With gcc 4.1:
> net/rxrpc/output.c: In function ârxrpc_send_data_packetâ:
> net/rxrpc/output.c:338: warning: âretâ may be used uninitialized in this function
> Indeed, if the first jump to the send_fragmentable label is made, and
> the address family is not handled in the switch() statement, ret will be
> used uninitialized.
> Fix this by BUG()'ing as is done in other places in rxrpc where internal
> support for future address families will need adding. It should not be
> possible to reach this normally as the address families are checked
> Fixes: 5a924b8951f835b5 ("rxrpc: Don't store the rxrpc header in the Tx queue sk_buffs")
> Reported-by: Geert Uytterhoeven <geert@xxxxxxxxxxxxxx>
> Signed-off-by: David Howells <dhowells@xxxxxxxxxx>
I'm not such a big fan of BUG(), so I'd go for ret = -EAFNOSUPPORT, but given
rxrpc is already full of BUG() calls, I guess it is an acceptable solution.
> diff --git a/net/rxrpc/output.c b/net/rxrpc/output.c
> index 004c762c2e8d..6f2b4fb4b0aa 100644
> --- a/net/rxrpc/output.c
> +++ b/net/rxrpc/output.c
> @@ -523,6 +523,9 @@ int rxrpc_send_data_packet(struct rxrpc_call *call, struct sk_buff *skb,
> + default:
> + BUG();
> if (ret < 0)
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@xxxxxxxxxxxxxx
In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds