From: Dan Carpenter <dan.carpenter@oracle.com>
To: kernel-janitors@vger.kernel.org
Subject: [bug report] fs/block_dev.c: add bdev_read_page() and bdev_write_page()
Date: Thu, 04 Aug 2016 14:02:06 +0000 [thread overview]
Message-ID: <20160804140206.GA11852@mwanda> (raw)
Hello Matthew Wilcox,
The patch 47a191fd38eb: "fs/block_dev.c: add bdev_read_page() and
bdev_write_page()" from Jun 4, 2014, leads to the following static
checker warning:
include/linux/genhd.h:382 part_inc_in_flight()
warn: buffer overflow 'part->in_flight' 2 <= 72
include/linux/genhd.h
380 static inline void part_inc_in_flight(struct hd_struct *part, int rw)
381 {
382 atomic_inc(&part->in_flight[rw]);
^^
This should either be READ or WRITE.
383 if (part->partno)
384 atomic_inc(&part_to_disk(part)->part0.in_flight[rw]);
385 }
444 int bdev_write_page(struct block_device *bdev, sector_t sector,
445 struct page *page, struct writeback_control *wbc)
446 {
447 int result;
448 int rw = (wbc->sync_mode = WB_SYNC_ALL) ? WRITE_SYNC : WRITE;
^^^^^^^^^^
But here we're setting it to WRITE_SYNC.
449 const struct block_device_operations *ops = bdev->bd_disk->fops;
450
451 if (!ops->rw_page || bdev_get_integrity(bdev))
452 return -EOPNOTSUPP;
453 result = blk_queue_enter(bdev->bd_queue, false);
454 if (result)
455 return result;
456
457 set_page_writeback(page);
458 result = ops->rw_page(bdev, sector + get_start_sect(bdev), page, rw);
459 if (result)
460 end_page_writeback(page);
461 else
462 unlock_page(page);
463 blk_queue_exit(bdev->bd_queue);
464 return result;
465 }
regards,
dan carpenter
next reply other threads:[~2016-08-04 14:02 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-08-04 14:02 Dan Carpenter [this message]
2016-09-15 8:56 ` [bug report] fs/block_dev.c: add bdev_read_page() and bdev_write_page() Dan Carpenter
2016-09-15 9:11 ` Dan Carpenter
2016-09-15 9:11 ` Dan Carpenter
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=20160804140206.GA11852@mwanda \
--to=dan.carpenter@oracle.com \
--cc=kernel-janitors@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 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.