All of lore.kernel.org
 help / color / mirror / Atom feed
* [dm:for-next 8/9] drivers//md/dm-log-writes.c:279:17: note: in expansion of macro 'min'
@ 2017-10-24 21:44 kbuild test robot
  2017-10-24 21:50 ` Ross Zwisler
  0 siblings, 1 reply; 3+ messages in thread
From: kbuild test robot @ 2017-10-24 21:44 UTC (permalink / raw)
  To: Ross Zwisler; +Cc: dm-devel, kbuild-all, Mike Snitzer

[-- Attachment #1: Type: text/plain, Size: 3687 bytes --]

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/device-mapper/linux-dm.git for-next
head:   ae613bbb0144e84cb3c0ebfa9f4fd4d1507c2f0e
commit: 6a697d036324c7fbe63fb49599027269006161e7 [8/9] dm log writes: add support for inline data buffers
config: i386-randconfig-x014-201743 (attached as .config)
compiler: gcc-6 (Debian 6.2.0-3) 6.2.0 20160901
reproduce:
        git checkout 6a697d036324c7fbe63fb49599027269006161e7
        # save the attached .config to linux build tree
        make ARCH=i386 

All warnings (new ones prefixed by >>):

   In file included from include/linux/list.h:8:0,
                    from include/linux/wait.h:6,
                    from include/linux/wait_bit.h:7,
                    from include/linux/fs.h:5,
                    from include/linux/highmem.h:4,
                    from include/linux/bio.h:21,
                    from include/linux/device-mapper.h:11,
                    from drivers//md/dm-log-writes.c:7:
   drivers//md/dm-log-writes.c: In function 'write_inline_data':
   include/linux/kernel.h:790:16: warning: comparison of distinct pointer types lacks a cast
     (void) (&min1 == &min2);   \
                   ^
   include/linux/kernel.h:799:2: note: in expansion of macro '__min'
     __min(typeof(x), typeof(y),   \
     ^~~~~
>> drivers//md/dm-log-writes.c:279:17: note: in expansion of macro 'min'
       pg_datalen = min(datalen, PAGE_SIZE);
                    ^~~

vim +/min +279 drivers//md/dm-log-writes.c

   248	
   249	static int write_inline_data(struct log_writes_c *lc, void *entry,
   250				     size_t entrylen, void *data, size_t datalen,
   251				     sector_t sector)
   252	{
   253		int num_pages, bio_pages, pg_datalen, pg_sectorlen, i;
   254		struct page *page;
   255		struct bio *bio;
   256		size_t ret;
   257		void *ptr;
   258	
   259		while (datalen) {
   260			num_pages = ALIGN(datalen, PAGE_SIZE) >> PAGE_SHIFT;
   261			bio_pages = min(num_pages, BIO_MAX_PAGES);
   262	
   263			atomic_inc(&lc->io_blocks);
   264	
   265			bio = bio_alloc(GFP_KERNEL, bio_pages);
   266			if (!bio) {
   267				DMERR("Couldn't alloc inline data bio");
   268				goto error;
   269			}
   270	
   271			bio->bi_iter.bi_size = 0;
   272			bio->bi_iter.bi_sector = sector;
   273			bio_set_dev(bio, lc->logdev->bdev);
   274			bio->bi_end_io = log_end_io;
   275			bio->bi_private = lc;
   276			bio_set_op_attrs(bio, REQ_OP_WRITE, 0);
   277	
   278			for (i = 0; i < bio_pages; i++) {
 > 279				pg_datalen = min(datalen, PAGE_SIZE);
   280				pg_sectorlen = ALIGN(pg_datalen, lc->sectorsize);
   281	
   282				page = alloc_page(GFP_KERNEL);
   283				if (!page) {
   284					DMERR("Couldn't alloc inline data page");
   285					goto error_bio;
   286				}
   287	
   288				ptr = kmap_atomic(page);
   289				memcpy(ptr, data, pg_datalen);
   290				if (pg_sectorlen > pg_datalen)
   291					memset(ptr + pg_datalen, 0, pg_sectorlen - pg_datalen);
   292				kunmap_atomic(ptr);
   293	
   294				ret = bio_add_page(bio, page, pg_sectorlen, 0);
   295				if (ret != pg_sectorlen) {
   296					DMERR("Couldn't add page of inline data");
   297					__free_page(page);
   298					goto error_bio;
   299				}
   300	
   301				datalen -= pg_datalen;
   302				data	+= pg_datalen;
   303			}
   304			submit_bio(bio);
   305	
   306			sector += bio_pages * PAGE_SECTORS;
   307		}
   308		return 0;
   309	error_bio:
   310		bio_free_pages(bio);
   311		bio_put(bio);
   312	error:
   313		put_io_block(lc);
   314		return -1;
   315	}
   316	

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 32506 bytes --]

[-- Attachment #3: Type: text/plain, Size: 0 bytes --]



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

* Re: [dm:for-next 8/9] drivers//md/dm-log-writes.c:279:17: note: in expansion of macro 'min'
  2017-10-24 21:44 [dm:for-next 8/9] drivers//md/dm-log-writes.c:279:17: note: in expansion of macro 'min' kbuild test robot
@ 2017-10-24 21:50 ` Ross Zwisler
  2017-10-24 22:55   ` Mike Snitzer
  0 siblings, 1 reply; 3+ messages in thread
From: Ross Zwisler @ 2017-10-24 21:50 UTC (permalink / raw)
  To: kbuild test robot; +Cc: Ross Zwisler, Mike Snitzer, kbuild-all, dm-devel

On Wed, Oct 25, 2017 at 05:44:34AM +0800, kbuild test robot wrote:
> tree:   https://git.kernel.org/pub/scm/linux/kernel/git/device-mapper/linux-dm.git for-next
> head:   ae613bbb0144e84cb3c0ebfa9f4fd4d1507c2f0e
> commit: 6a697d036324c7fbe63fb49599027269006161e7 [8/9] dm log writes: add support for inline data buffers
> config: i386-randconfig-x014-201743 (attached as .config)
> compiler: gcc-6 (Debian 6.2.0-3) 6.2.0 20160901
> reproduce:
>         git checkout 6a697d036324c7fbe63fb49599027269006161e7
>         # save the attached .config to linux build tree
>         make ARCH=i386 
> 
> All warnings (new ones prefixed by >>):
> 
>    In file included from include/linux/list.h:8:0,
>                     from include/linux/wait.h:6,
>                     from include/linux/wait_bit.h:7,
>                     from include/linux/fs.h:5,
>                     from include/linux/highmem.h:4,
>                     from include/linux/bio.h:21,
>                     from include/linux/device-mapper.h:11,
>                     from drivers//md/dm-log-writes.c:7:
>    drivers//md/dm-log-writes.c: In function 'write_inline_data':
>    include/linux/kernel.h:790:16: warning: comparison of distinct pointer types lacks a cast
>      (void) (&min1 == &min2);   \
>                    ^
>    include/linux/kernel.h:799:2: note: in expansion of macro '__min'
>      __min(typeof(x), typeof(y),   \
>      ^~~~~
> >> drivers//md/dm-log-writes.c:279:17: note: in expansion of macro 'min'
>        pg_datalen = min(datalen, PAGE_SIZE);
>                     ^~~
> 
> vim +/min +279 drivers//md/dm-log-writes.c
> 
>    248	
>    249	static int write_inline_data(struct log_writes_c *lc, void *entry,
>    250				     size_t entrylen, void *data, size_t datalen,
>    251				     sector_t sector)
>    252	{
>    253		int num_pages, bio_pages, pg_datalen, pg_sectorlen, i;
>    254		struct page *page;
>    255		struct bio *bio;
>    256		size_t ret;
>    257		void *ptr;
>    258	
>    259		while (datalen) {
>    260			num_pages = ALIGN(datalen, PAGE_SIZE) >> PAGE_SHIFT;
>    261			bio_pages = min(num_pages, BIO_MAX_PAGES);
>    262	
>    263			atomic_inc(&lc->io_blocks);
>    264	
>    265			bio = bio_alloc(GFP_KERNEL, bio_pages);
>    266			if (!bio) {
>    267				DMERR("Couldn't alloc inline data bio");
>    268				goto error;
>    269			}
>    270	
>    271			bio->bi_iter.bi_size = 0;
>    272			bio->bi_iter.bi_sector = sector;
>    273			bio_set_dev(bio, lc->logdev->bdev);
>    274			bio->bi_end_io = log_end_io;
>    275			bio->bi_private = lc;
>    276			bio_set_op_attrs(bio, REQ_OP_WRITE, 0);
>    277	
>    278			for (i = 0; i < bio_pages; i++) {
>  > 279				pg_datalen = min(datalen, PAGE_SIZE);

Thanks, 0-day, for the report.

So I think this just needs to be 

					pg_datalen = min((int)datalen, PAGE_SIZE);

since the resulting pg_datalen is also an int.

Mike can you fix up, or would you like an updated patch (or follow-on patch)
from me?

- Ross

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

* Re: [dm:for-next 8/9] drivers//md/dm-log-writes.c:279:17: note: in expansion of macro 'min'
  2017-10-24 21:50 ` Ross Zwisler
@ 2017-10-24 22:55   ` Mike Snitzer
  0 siblings, 0 replies; 3+ messages in thread
From: Mike Snitzer @ 2017-10-24 22:55 UTC (permalink / raw)
  To: Ross Zwisler; +Cc: dm-devel, kbuild test robot, kbuild-all

On Tue, Oct 24 2017 at  5:50pm -0400,
Ross Zwisler <ross.zwisler@linux.intel.com> wrote:
 
> So I think this just needs to be 
> 
> 					pg_datalen = min((int)datalen, PAGE_SIZE);
> 
> since the resulting pg_datalen is also an int.
> 
> Mike can you fix up, or would you like an updated patch (or follow-on patch)
> from me?

I went with: pg_datalen = min_t(int, datalen, PAGE_SIZE);

I've fixed it up and pushed it out to linux-next.

Mike

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

end of thread, other threads:[~2017-10-24 22:55 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-10-24 21:44 [dm:for-next 8/9] drivers//md/dm-log-writes.c:279:17: note: in expansion of macro 'min' kbuild test robot
2017-10-24 21:50 ` Ross Zwisler
2017-10-24 22:55   ` Mike Snitzer

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.