[dm:for-next 1/1] drivers/md/dm-verity-target.c:109:23: note: in expansion of macro 'min'

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



tree:   https://git.kernel.org/pub/scm/linux/kernel/git/device-mapper/linux-dm.git for-next
head:   43323993e68adf32894189c57245a13c2bc2ff91
commit: 43323993e68adf32894189c57245a13c2bc2ff91 [1/1] dm verity: fix crash on bufio buffer that was allocated with vmalloc
config: i386-randconfig-x000-201834 (attached as .config)
compiler: gcc-7 (Debian 7.3.0-16) 7.3.0
reproduce:
        git checkout 43323993e68adf32894189c57245a13c2bc2ff91
        # save the attached .config to linux build tree
        make ARCH=i386 

All warnings (new ones prefixed by >>):

   In file included from arch/x86/include/asm/percpu.h:45:0,
                    from arch/x86/include/asm/current.h:6,
                    from include/linux/sched.h:12,
                    from include/linux/blkdev.h:5,
                    from include/linux/dm-bufio.h:12,
                    from drivers/md/dm-verity.h:15,
                    from drivers/md/dm-verity-target.c:17:
   drivers/md/dm-verity-target.c: In function 'verity_hash_update':
   include/linux/kernel.h:845:29: warning: comparison of distinct pointer types lacks a cast
      (!!(sizeof((typeof(x) *)1 == (typeof(y) *)1)))
                                ^
   include/linux/kernel.h:859:4: note: in expansion of macro '__typecheck'
      (__typecheck(x, y) && __no_side_effects(x, y))
       ^~~~~~~~~~~
   include/linux/kernel.h:869:24: note: in expansion of macro '__safe_cmp'
     __builtin_choose_expr(__safe_cmp(x, y), \
                           ^~~~~~~~~~
   include/linux/kernel.h:878:19: note: in expansion of macro '__careful_cmp'
    #define min(x, y) __careful_cmp(x, y, <)
                      ^~~~~~~~~~~~~
>> drivers/md/dm-verity-target.c:109:23: note: in expansion of macro 'min'
       size_t this_step = min(len, PAGE_SIZE - offset_in_page(data));
                          ^~~

vim +/min +109 drivers/md/dm-verity-target.c

    95	
    96	static int verity_hash_update(struct dm_verity *v, struct ahash_request *req,
    97					const u8 *data, size_t len,
    98					struct crypto_wait *wait)
    99	{
   100		struct scatterlist sg;
   101	
   102		if (likely(!is_vmalloc_addr(data))) {
   103			sg_init_one(&sg, data, len);
   104			ahash_request_set_crypt(req, &sg, NULL, len);
   105			return crypto_wait_req(crypto_ahash_update(req), wait);
   106		} else {
   107			do {
   108				int r;
 > 109				size_t this_step = min(len, PAGE_SIZE - offset_in_page(data));
   110				flush_kernel_vmap_range((void *)data, this_step);
   111				sg_init_table(&sg, 1);
   112				sg_set_page(&sg, vmalloc_to_page(data), this_step, offset_in_page(data));
   113				ahash_request_set_crypt(req, &sg, NULL, this_step);
   114				r = crypto_wait_req(crypto_ahash_update(req), wait);
   115				if (unlikely(r))
   116					return r;
   117				data += this_step;
   118				len -= this_step;
   119			} while (len);
   120			return 0;
   121		}
   122	}
   123	

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

Attachment: .config.gz
Description: application/gzip

--
dm-devel mailing list
dm-devel@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/dm-devel

[Index of Archives]     [DM Crypt]     [Fedora Desktop]     [ATA RAID]     [Fedora Marketing]     [Fedora Packaging]     [Fedora SELinux]     [Yosemite Discussion]     [KDE Users]     [Fedora Docs]

  Powered by Linux