Netdev Archive on lore.kernel.org
help / color / mirror / Atom feed
From: Ivan Mikhaylov <i.mikhaylov@yadro.com>
To: Joel Stanley <joel@jms.id.au>
Cc: "David S . Miller" <davem@davemloft.net>,
	Jakub Kicinski <kuba@kernel.org>,
	Samuel Mendoza-Jonas <sam@mendozajonas.com>,
	"Benjamin Herrenschmidt" <benh@kernel.crashing.org>,
	Networking <netdev@vger.kernel.org>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	OpenBMC Maillist <openbmc@lists.ozlabs.org>
Subject: Re: [PATCH v2 1/3] net/ncsi: fix restricted cast warning of sparse
Date: Tue, 13 Jul 2021 12:08:56 +0300	[thread overview]
Message-ID: <796d759a685428814cfd68ae2fd69fe9ab5298dd.camel@yadro.com> (raw)
In-Reply-To: <CACPK8Xe2W-qTPjyuAHkTGq6Kz0sWYRz23Cqqdxu0CL2XNc=T0w@mail.gmail.com>

On Mon, 2021-07-12 at 09:09 +0000, Joel Stanley wrote:
> On Thu, 8 Jul 2021 at 12:27, Ivan Mikhaylov <i.mikhaylov@yadro.com> wrote:
> > 
> > Sparse reports:
> > net/ncsi/ncsi-rsp.c:406:24: warning: cast to restricted __be32
> > net/ncsi/ncsi-manage.c:732:33: warning: cast to restricted __be32
> > net/ncsi/ncsi-manage.c:756:25: warning: cast to restricted __be32
> > net/ncsi/ncsi-manage.c:779:25: warning: cast to restricted __be32
> 
> Strange, I don't get these warnings from sparse on my system.

https://patchwork.hopto.org/static/nipa/510079/12355969/build_32bit/stderr
All those errors from ntohl. David linked this one in first series of patches.

> 
> $ sparse --version
> 0.6.3 (Debian: 0.6.3-2)
> 
> > 
> > Signed-off-by: Ivan Mikhaylov <i.mikhaylov@yadro.com>
> > ---
> >  net/ncsi/ncsi-manage.c | 6 +++---
> >  net/ncsi/ncsi-rsp.c    | 2 +-
> >  2 files changed, 4 insertions(+), 4 deletions(-)
> > 
> > diff --git a/net/ncsi/ncsi-manage.c b/net/ncsi/ncsi-manage.c
> > index ca04b6df1341..42b54a3da2e6 100644
> > --- a/net/ncsi/ncsi-manage.c
> > +++ b/net/ncsi/ncsi-manage.c
> > @@ -700,7 +700,7 @@ static int ncsi_oem_gma_handler_bcm(struct ncsi_cmd_arg
> > *nca)
> >         nca->payload = NCSI_OEM_BCM_CMD_GMA_LEN;
> > 
> >         memset(data, 0, NCSI_OEM_BCM_CMD_GMA_LEN);
> > -       *(unsigned int *)data = ntohl(NCSI_OEM_MFR_BCM_ID);
> > +       *(unsigned int *)data = ntohl((__force __be32)NCSI_OEM_MFR_BCM_ID);
> 
> This looks wrong, the value you're passing isn't big endian. It would
> make more sense if the byte swap was ntohl, as it's coming from the
> cpu and going into the NCSI packet.

Is there any other ways to deal with those sparse errors?

Thanks.


  reply	other threads:[~2021-07-13  9:01 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-08 12:27 [PATCH v2 0/3] net/ncsi: Add NCSI Intel OEM command to keep PHY link up Ivan Mikhaylov
2021-07-08 12:27 ` [PATCH v2 1/3] net/ncsi: fix restricted cast warning of sparse Ivan Mikhaylov
2021-07-12  9:09   ` Joel Stanley
2021-07-13  9:08     ` Ivan Mikhaylov [this message]
2021-07-08 12:27 ` [PATCH v2 2/3] net/ncsi: add NCSI Intel OEM command to keep PHY up Ivan Mikhaylov
2021-07-12 10:01   ` Joel Stanley
2021-07-12 19:32     ` Eddie James
2021-07-13 10:16     ` Ivan Mikhaylov
2021-07-08 12:27 ` [PATCH v2 3/3] net/ncsi: add dummy response handler for Intel boards Ivan Mikhaylov
2021-07-12 10:03   ` Joel Stanley
2021-07-13  9:42     ` Ivan Mikhaylov
2021-07-20  9:41   ` Paul Fertser
2021-07-20 13:21     ` Ivan Mikhaylov
2021-07-20 13:29       ` Paul Fertser
2021-07-08 21:20 ` [PATCH v2 0/3] net/ncsi: Add NCSI Intel OEM command to keep PHY link up patchwork-bot+netdevbpf
2021-07-20  9:53 ` Paul Fertser
2021-07-20 14:00   ` Ivan Mikhaylov
2021-07-20 14:16     ` Paul Fertser

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=796d759a685428814cfd68ae2fd69fe9ab5298dd.camel@yadro.com \
    --to=i.mikhaylov@yadro.com \
    --cc=benh@kernel.crashing.org \
    --cc=davem@davemloft.net \
    --cc=joel@jms.id.au \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=openbmc@lists.ozlabs.org \
    --cc=sam@mendozajonas.com \
    --subject='Re: [PATCH v2 1/3] net/ncsi: fix restricted cast warning of sparse' \
    /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).