LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
From: Eran Ben Elisha <eranbe@mellanox.com>
To: Geert Uytterhoeven <geert@linux-m68k.org>,
Igor Konopko <igor.j.konopko@intel.com>,
David Howells <dhowells@redhat.com>,
"Mohit P . Tahiliani" <tahiliani@nitk.edu.in>,
Takashi Sakamoto <o-takashi@sakamocchi.jp>,
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>
Cc: "linux-block@vger.kernel.org" <linux-block@vger.kernel.org>,
"netdev@vger.kernel.org" <netdev@vger.kernel.org>,
"linux-afs@lists.infradead.org" <linux-afs@lists.infradead.org>,
"alsa-devel@alsa-project.org" <alsa-devel@alsa-project.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH 5/5] [RFC] devlink: Fix uninitialized error code in devlink_fmsg_prepare_skb()
Date: Tue, 28 May 2019 14:40:08 +0000 [thread overview]
Message-ID: <0f92eb11-20b5-c50b-1577-d3896f28c73b@mellanox.com> (raw)
In-Reply-To: <20190528142424.19626-6-geert@linux-m68k.org>
On 5/28/2019 5:24 PM, Geert Uytterhoeven wrote:
> With gcc 4.1:
>
> net/core/devlink.c: In function ‘devlink_fmsg_prepare_skb’:
> net/core/devlink.c:4325: warning: ‘err’ may be used uninitialized in this function
>
> Indeed, if the list has less than *start entries, an uninitialized error
> code will be returned.
The logic guarantees that start is smaller than the length of the list.
but I guess that the compiler can't detect that.
Reviewed-by: Eran Ben Elisha <eranbe@mellanox.com>
>
> Fix this by preinitializing err to zero.
>
> Fixes: 1db64e8733f65381 ("devlink: Add devlink formatted message (fmsg) API")
> Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
> ---
> I don't know if this can really happen, and if this is the right fix.
> Perhaps err should be initialized to some valid error code instead?
> ---
> net/core/devlink.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/net/core/devlink.c b/net/core/devlink.c
> index d43bc52b8840d76b..91377e4eae9a43c1 100644
> --- a/net/core/devlink.c
> +++ b/net/core/devlink.c
> @@ -4321,8 +4321,8 @@ devlink_fmsg_prepare_skb(struct devlink_fmsg *fmsg, struct sk_buff *skb,
> {
> struct devlink_fmsg_item *item;
> struct nlattr *fmsg_nlattr;
> + int err = 0;
> int i = 0;
> - int err;
>
> fmsg_nlattr = nla_nest_start_noflag(skb, DEVLINK_ATTR_FMSG);
> if (!fmsg_nlattr)
>
next prev parent reply other threads:[~2019-05-28 14:40 UTC|newest]
Thread overview: 20+ 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-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-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-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 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 [this message]
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-04 7:17 ` Geert Uytterhoeven
2019-06-04 7:34 ` David Howells
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=0f92eb11-20b5-c50b-1577-d3896f28c73b@mellanox.com \
--to=eranbe@mellanox.com \
--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=geert@linux-m68k.org \
--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 \
--subject='Re: [PATCH 5/5] [RFC] devlink: Fix uninitialized error code in devlink_fmsg_prepare_skb()' \
/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
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).