From: Alexey Dobriyan <adobriyan@gmail.com>
To: "Michael S. Tsirkin" <mst@mellanox.co.il>, Tom Duffy <tduffy@sun.com>
Cc: linux-kernel@vger.kernel.org, openib-general@openib.org
Subject: Re: [PATCH 3/27] Add MAD helper functions
Date: Wed, 13 Jul 2005 02:48:07 +0400 [thread overview]
Message-ID: <200507130248.08387.adobriyan@gmail.com> (raw)
In-Reply-To: <20050712221725.GB14316@mellanox.co.il>
On Wednesday 13 July 2005 02:17, Michael S. Tsirkin wrote:
> Quoting r. Tom Duffy <tduffy@sun.com>:
> > These seem to be mostly coming from cpu_to_be*() and be*_to_cpu(). Is
> > there a good rule of thumb for fixing these warnings?
>
> Yes.
> Use attributes like __be32 and friends appropriately.
ITYM types. ;-)
Tom, see, for example, drivers/infiniband/core/sysfs.c:
----------------------------------------------------------------------------
313 in_mad->mad_hdr.attr_id = cpu_to_be16(0x12); /* PortCounters */
----------------------------------------------------------------------------
drivers/infiniband/core/sysfs.c:313:32: warning: incorrect type in assignment (different base types)
drivers/infiniband/core/sysfs.c:313:32: expected unsigned short [unsigned] [usertype] attr_id
drivers/infiniband/core/sysfs.c:313:32: got restricted unsigned short [usertype] [force] <noident>
----------------------------------------------------------------------------
Grepping for attr_id in drivers/infiniband/ shows that:
1) in_mad->attr_id is set to IB_SMP_ATTR_NODE_INFO (network order)
2) mad->mad_hdr.attr_id is compared with IB_SMP_ATTR_PORT_INFO (network order)
3) *->mad_hdr.attr_id is set to big-endian value
All this suggests that struct ib_mad_hdr::attr_id should be __be16 instead of
u16. So, if attr_id is really something big-endian (infiniband people should
know), convert it. If not (unlikely) all those cpu_to_be16() and htons() are
bogus.
HO-WE-VER, be careful and don't blindly shut up sparse. Its warnings exist to
uncover real bugs.
prev parent reply other threads:[~2005-07-12 22:45 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-07-11 13:48 [PATCH 3/27] Add MAD helper functions Hal Rosenstock
2005-07-11 14:39 ` Alexey Dobriyan
2005-07-11 15:30 ` Hal Rosenstock
2005-07-11 16:05 ` [openib-general] " Nishanth Aravamudan
2005-07-11 16:14 ` Hal Rosenstock
2005-07-11 16:29 ` Alexey Dobriyan
2005-07-11 16:58 ` Hal Rosenstock
2005-07-11 17:52 ` [openib-general] " Tom Duffy
2005-07-11 18:38 ` Alexey Dobriyan
2005-07-12 21:32 ` Tom Duffy
2005-07-12 22:17 ` Michael S. Tsirkin
2005-07-12 22:48 ` Alexey Dobriyan [this message]
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=200507130248.08387.adobriyan@gmail.com \
--to=adobriyan@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mst@mellanox.co.il \
--cc=openib-general@openib.org \
--cc=tduffy@sun.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 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).