All of lore.kernel.org
 help / color / mirror / Atom feed
From: Geert Uytterhoeven <geert@linux-m68k.org>
To: David Howells <dhowells@redhat.com>
Cc: Igor Konopko <igor.j.konopko@intel.com>,
	"Mohit P . Tahiliani" <tahiliani@nitk.edu.in>,
	Takashi Sakamoto <o-takashi@sakamocchi.jp>,
	Eran Ben Elisha <eranbe@mellanox.com>,
	Matias Bjorling <mb@lightnvm.io>, Jiri Pirko <jiri@mellanox.com>,
	"David S . Miller" <davem@davemloft.net>,
	Jamal Hadi Salim <jhs@mojatatu.com>,
	Cong Wang <xiyou.wangcong@gmail.com>,
	Clemens Ladisch <clemens@ladisch.de>,
	Jaroslav Kysela <perex@perex.cz>, Takashi Iwai <tiwai@suse.com>,
	Joe Perches <joe@perches.com>, Arnd Bergmann <arnd@arndb.de>,
	Dan Carpenter <dan.carpenter@oracle.com>,
	linux-block@vger.kernel.org, netdev <netdev@vger.kernel.org>,
	linux-afs@lists.infradead.org,
	ALSA Development Mailing List <alsa-devel@alsa-project.org>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] rxrpc: Fix uninitialized error code in rxrpc_send_data_packet()
Date: Tue, 4 Jun 2019 09:17:23 +0200	[thread overview]
Message-ID: <CAMuHMdX57DKCMpLXdtZPE-w0esUNVv9-SwYjmT5=m+u9ryAiHQ@mail.gmail.com> (raw)
In-Reply-To: <15499.1559298884@warthog.procyon.org.uk>

Hi David,

On Fri, May 31, 2019 at 12:35 PM David Howells <dhowells@redhat.com> wrote:
> Here's my take on the patch.
>
> David
> ---
> 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
> up-front.
>
> Fixes: 5a924b8951f835b5 ("rxrpc: Don't store the rxrpc header in the Tx queue sk_buffs")
> Reported-by: Geert Uytterhoeven <geert@linux-m68k.org>
> Signed-off-by: David Howells <dhowells@redhat.com>

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,
>                 }
>                 break;
>  #endif
> +
> +       default:
> +               BUG();
>         }
>
>         if (ret < 0)

Gr{oetje,eeting}s,

                        Geert

-- 
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

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

WARNING: multiple messages have this Message-ID (diff)
From: Geert Uytterhoeven <geert@linux-m68k.org>
To: David Howells <dhowells@redhat.com>
Cc: Igor Konopko <igor.j.konopko@intel.com>,
	"Mohit P . Tahiliani" <tahiliani@nitk.edu.in>,
	Takashi Sakamoto <o-takashi@sakamocchi.jp>,
	Eran Ben Elisha <eranbe@mellanox.com>,
	Matias Bjorling <mb@lightnvm.io>, Jiri Pirko <jiri@mellanox.com>,
	"David S . Miller" <davem@davemloft.net>,
	Jamal Hadi Salim <jhs@mojatatu.com>,
	Cong Wang <xiyou.wangcong@gmail.com>,
	Clemens Ladisch <clemens@ladisch.de>,
	Jaroslav Kysela <perex@perex.cz>, Takashi Iwai <tiwai@suse.com>,
	Joe Perches <joe@perches.com>, Arnd Bergmann <arnd@arndb.de>,
	Dan Carpenter <dan.carpenter@oracle.com>,
	linux-block@vger.kernel.org, netdev <netdev@vger.kernel.org>,
	linux-afs@lists.infradead.org,
	ALSA Development Mailing List <alsa-devel@alsa-project.org>,
	Linux Kernel Mailing List <linux-kernel@vger.>
Subject: Re: [PATCH] rxrpc: Fix uninitialized error code in rxrpc_send_data_packet()
Date: Tue, 4 Jun 2019 09:17:23 +0200	[thread overview]
Message-ID: <CAMuHMdX57DKCMpLXdtZPE-w0esUNVv9-SwYjmT5=m+u9ryAiHQ@mail.gmail.com> (raw)
In-Reply-To: <15499.1559298884@warthog.procyon.org.uk>

Hi David,

On Fri, May 31, 2019 at 12:35 PM David Howells <dhowells@redhat.com> wrote:
> Here's my take on the patch.
>
> David
> ---
> 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
> up-front.
>
> Fixes: 5a924b8951f835b5 ("rxrpc: Don't store the rxrpc header in the Tx queue sk_buffs")
> Reported-by: Geert Uytterhoeven <geert@linux-m68k.org>
> Signed-off-by: David Howells <dhowells@redhat.com>

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,
>                 }
>                 break;
>  #endif
> +
> +       default:
> +               BUG();
>         }
>
>         if (ret < 0)

Gr{oetje,eeting}s,

                        Geert

-- 
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

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

  parent reply	other threads:[~2019-06-04  7:17 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-05-28 14:24 [PATCH 0/5] Assorted fixes discovered with gcc 4.1 Geert Uytterhoeven
2019-05-28 14:24 ` [PATCH 1/5] lightnvm: Fix uninitialized pointer in nvm_remove_tgt() Geert Uytterhoeven
2019-05-29  8:08   ` Matias Bjørling
2019-05-29  8:12     ` Geert Uytterhoeven
2019-05-29  8:12       ` Geert Uytterhoeven
2019-05-28 14:24 ` [PATCH 2/5] rxrpc: Fix uninitialized error code in rxrpc_send_data_packet() Geert Uytterhoeven
2019-05-29 11:49   ` Arnd Bergmann
2019-05-29 11:49     ` Arnd Bergmann
2019-05-28 14:24 ` [PATCH 3/5] net: sched: pie: Use ULL suffix for 64-bit constant Geert Uytterhoeven
2019-05-29 11:39   ` Arnd Bergmann
2019-05-29 11:39     ` Arnd Bergmann
2019-05-28 14:24 ` [PATCH 4/5] ALSA: fireface: Use ULL suffixes for 64-bit constants Geert Uytterhoeven
2019-05-29  9:57   ` Takashi Sakamoto
2019-05-29  9:57     ` Takashi Sakamoto
2019-05-29 10:07     ` Takashi Iwai
2019-05-29 10:07       ` Takashi Iwai
2019-05-28 14:24 ` [PATCH 5/5] [RFC] devlink: Fix uninitialized error code in devlink_fmsg_prepare_skb() Geert Uytterhoeven
2019-05-28 14:40   ` Eran Ben Elisha
2019-05-29  8:04   ` Jiri Pirko
2019-05-28 16:30 ` [PATCH 2/5] rxrpc: Fix uninitialized error code in rxrpc_send_data_packet() David Howells
2019-05-31 10:34 ` [PATCH] " David Howells
2019-06-03 21:30   ` David Miller
2019-06-03 21:30     ` David Miller
2019-06-04  7:17   ` Geert Uytterhoeven [this message]
2019-06-04  7:17     ` Geert Uytterhoeven
2019-06-04  7:34   ` David Howells
2019-06-04  7:34     ` David Howells
2019-06-04  7:35     ` Geert Uytterhoeven
2019-06-04  7:35       ` Geert Uytterhoeven

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAMuHMdX57DKCMpLXdtZPE-w0esUNVv9-SwYjmT5=m+u9ryAiHQ@mail.gmail.com' \
    --to=geert@linux-m68k.org \
    --cc=alsa-devel@alsa-project.org \
    --cc=arnd@arndb.de \
    --cc=clemens@ladisch.de \
    --cc=dan.carpenter@oracle.com \
    --cc=davem@davemloft.net \
    --cc=dhowells@redhat.com \
    --cc=eranbe@mellanox.com \
    --cc=igor.j.konopko@intel.com \
    --cc=jhs@mojatatu.com \
    --cc=jiri@mellanox.com \
    --cc=joe@perches.com \
    --cc=linux-afs@lists.infradead.org \
    --cc=linux-block@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mb@lightnvm.io \
    --cc=netdev@vger.kernel.org \
    --cc=o-takashi@sakamocchi.jp \
    --cc=perex@perex.cz \
    --cc=tahiliani@nitk.edu.in \
    --cc=tiwai@suse.com \
    --cc=xiyou.wangcong@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.