All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] NTB: amd: Silence shift wrapping warning in amd_ntb_db_vector_mask()
@ 2019-03-25  9:23 ` Dan Carpenter
  0 siblings, 0 replies; 6+ messages in thread
From: Dan Carpenter @ 2019-03-25  9:23 UTC (permalink / raw)
  To: kernel-janitors

This code triggers a Smatch warning:

    drivers/ntb/hw/amd/ntb_hw_amd.c:336 amd_ntb_db_vector_mask()
    warn: should '(1 << db_vector)' be a 64 bit type?

I don't think "db_vector" can be higher than 16 so this doesn't affect
runtime, but it's nice to silence the static checker warning and we
might increase "ndev->db_count" in the future.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
---
 drivers/ntb/hw/amd/ntb_hw_amd.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/ntb/hw/amd/ntb_hw_amd.c b/drivers/ntb/hw/amd/ntb_hw_amd.c
index 16c10dfe0919..84aec5500df3 100644
--- a/drivers/ntb/hw/amd/ntb_hw_amd.c
+++ b/drivers/ntb/hw/amd/ntb_hw_amd.c
@@ -333,7 +333,7 @@ static u64 amd_ntb_db_vector_mask(struct ntb_dev *ntb, int db_vector)
 	if (db_vector < 0 || db_vector > ndev->db_count)
 		return 0;
 
-	return ntb_ndev(ntb)->db_valid_mask & (1 << db_vector);
+	return ntb_ndev(ntb)->db_valid_mask & (1ULL << db_vector);
 }
 
 static u64 amd_ntb_db_read(struct ntb_dev *ntb)
-- 
2.17.1

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH] NTB: amd: Silence shift wrapping warning in amd_ntb_db_vector_mask()
@ 2019-03-25  9:23 ` Dan Carpenter
  0 siblings, 0 replies; 6+ messages in thread
From: Dan Carpenter @ 2019-03-25  9:23 UTC (permalink / raw)
  To: Shyam Sundar S K
  Cc: Jon Mason, Dave Jiang, Allen Hubbe, linux-ntb, kernel-janitors

This code triggers a Smatch warning:

    drivers/ntb/hw/amd/ntb_hw_amd.c:336 amd_ntb_db_vector_mask()
    warn: should '(1 << db_vector)' be a 64 bit type?

I don't think "db_vector" can be higher than 16 so this doesn't affect
runtime, but it's nice to silence the static checker warning and we
might increase "ndev->db_count" in the future.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
---
 drivers/ntb/hw/amd/ntb_hw_amd.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/ntb/hw/amd/ntb_hw_amd.c b/drivers/ntb/hw/amd/ntb_hw_amd.c
index 16c10dfe0919..84aec5500df3 100644
--- a/drivers/ntb/hw/amd/ntb_hw_amd.c
+++ b/drivers/ntb/hw/amd/ntb_hw_amd.c
@@ -333,7 +333,7 @@ static u64 amd_ntb_db_vector_mask(struct ntb_dev *ntb, int db_vector)
 	if (db_vector < 0 || db_vector > ndev->db_count)
 		return 0;
 
-	return ntb_ndev(ntb)->db_valid_mask & (1 << db_vector);
+	return ntb_ndev(ntb)->db_valid_mask & (1ULL << db_vector);
 }
 
 static u64 amd_ntb_db_read(struct ntb_dev *ntb)
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH] NTB: amd: Silence shift wrapping warning in amd_ntb_db_vector_mask()
  2019-03-25  9:23 ` Dan Carpenter
@ 2019-03-26  5:46   ` S-k, Shyam-sundar
  -1 siblings, 0 replies; 6+ messages in thread
From: S-k, Shyam-sundar @ 2019-03-26  5:46 UTC (permalink / raw)
  To: kernel-janitors

T24gMy8yNS8yMDE5IDI6NTMgUE0sIERhbiBDYXJwZW50ZXIgd3JvdGU6DQo+IFRoaXMgY29kZSB0
cmlnZ2VycyBhIFNtYXRjaCB3YXJuaW5nOg0KPg0KPiAgICAgZHJpdmVycy9udGIvaHcvYW1kL250
Yl9od19hbWQuYzozMzYgYW1kX250Yl9kYl92ZWN0b3JfbWFzaygpDQo+ICAgICB3YXJuOiBzaG91
bGQgJygxIDw8IGRiX3ZlY3RvciknIGJlIGEgNjQgYml0IHR5cGU/DQo+DQo+IEkgZG9uJ3QgdGhp
bmsgImRiX3ZlY3RvciIgY2FuIGJlIGhpZ2hlciB0aGFuIDE2IHNvIHRoaXMgZG9lc24ndCBhZmZl
Y3QNCj4gcnVudGltZSwgYnV0IGl0J3MgbmljZSB0byBzaWxlbmNlIHRoZSBzdGF0aWMgY2hlY2tl
ciB3YXJuaW5nIGFuZCB3ZQ0KPiBtaWdodCBpbmNyZWFzZSAibmRldi0+ZGJfY291bnQiIGluIHRo
ZSBmdXR1cmUuDQo+DQo+IFNpZ25lZC1vZmYtYnk6IERhbiBDYXJwZW50ZXIgPGRhbi5jYXJwZW50
ZXJAb3JhY2xlLmNvbT4NCkFja2VkLWJ5OiBTaHlhbSBTdW5kYXIgUyBLIDxTaHlhbS1zdW5kYXIu
Uy1rQGFtZC5jb20+DQo

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] NTB: amd: Silence shift wrapping warning in amd_ntb_db_vector_mask()
@ 2019-03-26  5:46   ` S-k, Shyam-sundar
  0 siblings, 0 replies; 6+ messages in thread
From: S-k, Shyam-sundar @ 2019-03-26  5:46 UTC (permalink / raw)
  To: Dan Carpenter
  Cc: Jon Mason, Dave Jiang, Allen Hubbe, linux-ntb@googlegroups.com,
	kernel-janitors@vger.kernel.org

On 3/25/2019 2:53 PM, Dan Carpenter wrote:
> This code triggers a Smatch warning:
>
>     drivers/ntb/hw/amd/ntb_hw_amd.c:336 amd_ntb_db_vector_mask()
>     warn: should '(1 << db_vector)' be a 64 bit type?
>
> I don't think "db_vector" can be higher than 16 so this doesn't affect
> runtime, but it's nice to silence the static checker warning and we
> might increase "ndev->db_count" in the future.
>
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Acked-by: Shyam Sundar S K <Shyam-sundar.S-k@amd.com>

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] NTB: amd: Silence shift wrapping warning in amd_ntb_db_vector_mask()
  2019-03-26  5:46   ` S-k, Shyam-sundar
@ 2019-06-13 13:26   ` Jon Mason
  -1 siblings, 0 replies; 6+ messages in thread
From: Jon Mason @ 2019-06-13 13:26 UTC (permalink / raw)
  To: kernel-janitors

On Tue, Mar 26, 2019 at 05:46:44AM +0000, S-k, Shyam-sundar wrote:
> On 3/25/2019 2:53 PM, Dan Carpenter wrote:
> > This code triggers a Smatch warning:
> >
> >     drivers/ntb/hw/amd/ntb_hw_amd.c:336 amd_ntb_db_vector_mask()
> >     warn: should '(1 << db_vector)' be a 64 bit type?
> >
> > I don't think "db_vector" can be higher than 16 so this doesn't affect
> > runtime, but it's nice to silence the static checker warning and we
> > might increase "ndev->db_count" in the future.
> >
> > Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> Acked-by: Shyam Sundar S K <Shyam-sundar.S-k@amd.com>

Sorry for the delay.  The patch is now in the ntb branch.  We've
missed window for 5.2, but it will be in the 5.3 pull request.

Thanks,
Jon

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] NTB: amd: Silence shift wrapping warning in amd_ntb_db_vector_mask()
@ 2019-06-13 13:26   ` Jon Mason
  0 siblings, 0 replies; 6+ messages in thread
From: Jon Mason @ 2019-06-13 13:26 UTC (permalink / raw)
  To: S-k, Shyam-sundar
  Cc: Dan Carpenter, Dave Jiang, Allen Hubbe,
	linux-ntb@googlegroups.com, kernel-janitors@vger.kernel.org

On Tue, Mar 26, 2019 at 05:46:44AM +0000, S-k, Shyam-sundar wrote:
> On 3/25/2019 2:53 PM, Dan Carpenter wrote:
> > This code triggers a Smatch warning:
> >
> >     drivers/ntb/hw/amd/ntb_hw_amd.c:336 amd_ntb_db_vector_mask()
> >     warn: should '(1 << db_vector)' be a 64 bit type?
> >
> > I don't think "db_vector" can be higher than 16 so this doesn't affect
> > runtime, but it's nice to silence the static checker warning and we
> > might increase "ndev->db_count" in the future.
> >
> > Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> Acked-by: Shyam Sundar S K <Shyam-sundar.S-k@amd.com>

Sorry for the delay.  The patch is now in the ntb branch.  We've
missed window for 5.2, but it will be in the 5.3 pull request.

Thanks,
Jon

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2019-06-13 13:26 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-03-25  9:23 [PATCH] NTB: amd: Silence shift wrapping warning in amd_ntb_db_vector_mask() Dan Carpenter
2019-03-25  9:23 ` Dan Carpenter
2019-03-26  5:46 ` S-k, Shyam-sundar
2019-03-26  5:46   ` S-k, Shyam-sundar
2019-06-13 13:26 ` Jon Mason
2019-06-13 13:26   ` Jon Mason

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.