kernel-janitors.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Re: block: make /sys/block/<dev>/queue/discard_max_bytes writeable
@ 2015-07-20 14:58 Jens Axboe
  2015-07-20 14:59 ` Dan Carpenter
  0 siblings, 1 reply; 2+ messages in thread
From: Jens Axboe @ 2015-07-20 14:58 UTC (permalink / raw)
  To: kernel-janitors

On 07/20/2015 08:59 AM, Dan Carpenter wrote:
> Hello Jens Axboe,
>
> The patch d45a0f150e9d: "block: make
> /sys/block/<dev>/queue/discard_max_bytes writeable" from Jul 16,
> 2015, leads to the following static checker warning:
>
> 	block/blk-sysfs.c:152 queue_discard_max_hw_show()
> 	warn: should 'q->limits.max_hw_discard_sectors << 9' be a 64 bit type?
>
> block/blk-sysfs.c
>     148  static ssize_t queue_discard_max_hw_show(struct request_queue *q, char *page)
>     149  {
>     150          unsigned long long val;
>     151
>     152          val = q->limits.max_hw_discard_sectors << 9;
>                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
> It definitely looks like this can wrap.

Yeah it can, that should be cast to unsigned long long for the shift. 
I'll make that change.

-- 
Jens Axboe


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

* re: block: make /sys/block/<dev>/queue/discard_max_bytes writeable
  2015-07-20 14:58 block: make /sys/block/<dev>/queue/discard_max_bytes writeable Jens Axboe
@ 2015-07-20 14:59 ` Dan Carpenter
  0 siblings, 0 replies; 2+ messages in thread
From: Dan Carpenter @ 2015-07-20 14:59 UTC (permalink / raw)
  To: kernel-janitors

Hello Jens Axboe,

The patch d45a0f150e9d: "block: make
/sys/block/<dev>/queue/discard_max_bytes writeable" from Jul 16,
2015, leads to the following static checker warning:

	block/blk-sysfs.c:152 queue_discard_max_hw_show()
	warn: should 'q->limits.max_hw_discard_sectors << 9' be a 64 bit type?

block/blk-sysfs.c
   148  static ssize_t queue_discard_max_hw_show(struct request_queue *q, char *page)
   149  {
   150          unsigned long long val;
   151  
   152          val = q->limits.max_hw_discard_sectors << 9;
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
It definitely looks like this can wrap.

   153          return sprintf(page, "%llu\n", val);
   154  }

regards,
dan carpenter

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

end of thread, other threads:[~2015-07-20 14:59 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-07-20 14:58 block: make /sys/block/<dev>/queue/discard_max_bytes writeable Jens Axboe
2015-07-20 14:59 ` Dan Carpenter

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).