[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20221208104318.hq3ze7vaskbcpuix@lion.mk-sys.cz>
Date: Thu, 8 Dec 2022 11:43:18 +0100
From: Michal Kubecek <mkubecek@...e.cz>
To: Jesse Brandeburg <jesse.brandeburg@...el.com>
Cc: netdev@...r.kernel.org
Subject: Re: [PATCH ethtool v2 05/13] ethtool: fix extra warnings
On Wed, Dec 07, 2022 at 05:11:14PM -0800, Jesse Brandeburg wrote:
> '$ scan-build make' reports
>
> netlink/permaddr.c:44:2: warning: Value stored to 'ifinfo' is never read [deadcode.DeadStores]
> ifinfo = mnl_nlmsg_put_extra_header(nlhdr, sizeof(*ifinfo));
> ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>
> So just remove the extra assignment which is never used.
>
> Fixes: 7f3585b22a4b ("netlink: add handler for permaddr (-P)")
> Signed-off-by: Jesse Brandeburg <jesse.brandeburg@...el.com>
> ---
> netlink/permaddr.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/netlink/permaddr.c b/netlink/permaddr.c
> index 006eac6c0094..dccb0c6cfdb7 100644
> --- a/netlink/permaddr.c
> +++ b/netlink/permaddr.c
> @@ -41,7 +41,7 @@ static int permaddr_prep_request(struct nl_socket *nlsk)
> nlhdr->nlmsg_type = RTM_GETLINK;
> nlhdr->nlmsg_flags = nlm_flags;
> msgbuff->nlhdr = nlhdr;
> - ifinfo = mnl_nlmsg_put_extra_header(nlhdr, sizeof(*ifinfo));
> + mnl_nlmsg_put_extra_header(nlhdr, sizeof(*ifinfo));
Good point. But looking at the code, the variable isn't in fact used
at all, except of the two occurences of sizeof(*ifinfo). So we can
just as well replace them with sizeof(struct ifinfomsg) and drop the
variable.
Michal
>
> if (devname) {
> uint16_t type = IFLA_IFNAME;
> --
> 2.31.1
>
Download attachment "signature.asc" of type "application/pgp-signature" (489 bytes)
Powered by blists - more mailing lists