Message ID | 20170906134558.3279199-1-arnd@arndb.de (mailing list archive) |
---|---|
State | Superseded |
Headers | show |
On Wed, Sep 06, 2017 at 03:45:31PM +0200, Arnd Bergmann wrote: > We get a harmless warning about the fact that we use the result of a > multiplication as a condition: Please just turn the thing into a function while you're at it. I'm not even sure it needs to be inline.. -- To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
On Wed, Sep 6, 2017 at 3:58 PM, Christoph Hellwig <hch@infradead.org> wrote: > On Wed, Sep 06, 2017 at 03:45:31PM +0200, Arnd Bergmann wrote: >> We get a harmless warning about the fact that we use the result of a >> multiplication as a condition: > > Please just turn the thing into a function while you're at it. > I'm not even sure it needs to be inline.. Ok, the patch gets quite big once I also modify INIT_UDATA the same way, but it seems like a good cleanup anyway. INIT_UDATA (renamed to ib_uverbs_init_udata()) should definitely remain inline, so I'm leaving both that way. Arnd -- To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
diff --git a/drivers/infiniband/core/uverbs.h b/drivers/infiniband/core/uverbs.h index 37c8903e7fd0..986a8a66ebbe 100644 --- a/drivers/infiniband/core/uverbs.h +++ b/drivers/infiniband/core/uverbs.h @@ -55,12 +55,14 @@ (udata)->outlen = (olen); \ } while (0) -#define INIT_UDATA_BUF_OR_NULL(udata, ibuf, obuf, ilen, olen) \ - do { \ - (udata)->inbuf = (ilen) ? (const void __user *) (ibuf) : NULL; \ - (udata)->outbuf = (olen) ? (void __user *) (obuf) : NULL; \ - (udata)->inlen = (ilen); \ - (udata)->outlen = (olen); \ +#define INIT_UDATA_BUF_OR_NULL(udata, ibuf, obuf, ilen, olen) \ + do { \ + (udata)->inbuf = (ilen) > 0 ? \ + (const void __user *) (ibuf) : NULL; \ + (udata)->outbuf = (olen) > 0 ? \ + (void __user *) (obuf) : NULL; \ + (udata)->inlen = (ilen); \ + (udata)->outlen = (olen); \ } while (0) /*