From: Jason Gunthorpe <jgg@ziepe.ca>
To: Bernard Metzler <BMT@zurich.ibm.com>
Cc: Doug Ledford <dledford@redhat.com>,
Leon Romanovsky <leon@kernel.org>,
linux-rdma@vger.kernel.org, geert@linux-m68k.org
Subject: Re: [PATCH v3] RDMA/siw: Fix 64/32bit pointer inconsistency
Date: Fri, 23 Aug 2019 11:42:21 -0300 [thread overview]
Message-ID: <20190823144221.GF12968@ziepe.ca> (raw)
In-Reply-To: <OF013F89F4.F7760460-ON0025845F.004F2CE0-0025845F.00500308@notes.na.collabserv.com>
On Fri, Aug 23, 2019 at 02:33:56PM +0000, Bernard Metzler wrote:
> >> > diff --git a/drivers/infiniband/sw/siw/siw_cm.c
> >> > b/drivers/infiniband/sw/siw/siw_cm.c
> >> > index 9ce8a1b925d2..ae7ea3ad7224 100644
> >> > +++ b/drivers/infiniband/sw/siw/siw_cm.c
> >> > @@ -355,8 +355,8 @@ static int siw_cm_upcall(struct siw_cep *cep,
> >> > enum iw_cm_event_type reason,
> >> > getname_local(cep->sock, &event.local_addr);
> >> > getname_peer(cep->sock, &event.remote_addr);
> >> > }
> >> > - siw_dbg_cep(cep, "[QP %u]: id 0x%p, reason=%d, status=%d\n",
> >> > - cep->qp ? qp_id(cep->qp) : -1, id, reason, status);
> >> > + siw_dbg_cep(cep, "[QP %u]: reason=%d, status=%d\n",
> >> > + cep->qp ? qp_id(cep->qp) : -1, reason, status);
> >> ^^^^
> >> There is a chance that such construction (attempt to print -1 with
> >%u)
> >> will generate some sort of warning.
> >>
> >> Thanks
> >
> >I didn't see any warnings when I built it. And %u->-1 would be the
> >same
> >error on 64bit or 32bit, so I think we're safe here.
> >
>
> Doug,
> May I ask you to amend this patch in a way which would
> just stop this monument of programming stupidity from
> prolonging into the future, while of course recognizing
> the impossibility of erasing it from the past?
> Exchanging the %u with %d would help me regaining
> some self-confidence ;)
A
q?a:b
Expression has only a single type. There are some tricky rules on
this, but since gcc does not complain on the %u it means
'q?(u32):(int)' is a (u32) and the -1 is implicitly casted.
The better thing to write would have been U32_MAX instead of -1
Jason
next prev parent reply other threads:[~2019-08-23 14:42 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-08-22 17:37 [PATCH v3] RDMA/siw: Fix 64/32bit pointer inconsistency Bernard Metzler
2019-08-22 18:41 ` Leon Romanovsky
2019-08-22 19:08 ` Doug Ledford
2019-08-22 19:26 ` Leon Romanovsky
2019-08-23 14:33 ` Bernard Metzler
2019-08-23 14:42 ` Jason Gunthorpe [this message]
2019-08-23 15:05 ` Bernard Metzler
2019-08-23 16:13 ` Doug Ledford
2019-08-23 16:15 ` Jason Gunthorpe
2019-08-23 16:39 ` Doug Ledford
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=20190823144221.GF12968@ziepe.ca \
--to=jgg@ziepe.ca \
--cc=BMT@zurich.ibm.com \
--cc=dledford@redhat.com \
--cc=geert@linux-m68k.org \
--cc=leon@kernel.org \
--cc=linux-rdma@vger.kernel.org \
/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