[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20210331043432.GF2065@kadam>
Date: Wed, 31 Mar 2021 07:34:32 +0300
From: Dan Carpenter <dan.carpenter@...cle.com>
To: kbuild@...ts.01.org, glittao@...il.com, cl@...ux.com,
penberg@...nel.org, rientjes@...gle.com, iamjoonsoo.kim@....com,
akpm@...ux-foundation.org, vbabka@...e.cz
Cc: lkp@...el.com, kbuild-all@...ts.01.org,
linux-kernel@...r.kernel.org, linux-mm@...ck.org,
Oliver Glitta <glittao@...il.com>
Subject: Re: [PATCH v2 1/2] kunit: add a KUnit test for SLUB debugging
functionality
Hi,
url: https://github.com/0day-ci/linux/commits/glittao-gmail-com/kunit-add-a-KUnit-test-for-SLUB-debugging-functionality/20210330-200635
base: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git 1e43c377a79f9189fea8f2711b399d4e8b4e609b
config: i386-randconfig-m021-20210330 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-22) 9.3.0
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@...el.com>
Reported-by: Dan Carpenter <dan.carpenter@...cle.com>
smatch warnings:
mm/slub.c:744 object_err() warn: should this be a bitwise op?
mm/slub.c:759 slab_err() warn: should this be a bitwise op?
mm/slub.c:807 check_bytes_and_report() warn: should this be a bitwise op?
vim +744 mm/slub.c
75c66def8d8152 Andrey Ryabinin 2015-02-13 741 void object_err(struct kmem_cache *s, struct page *page,
81819f0fc8285a Christoph Lameter 2007-05-06 742 u8 *object, char *reason)
81819f0fc8285a Christoph Lameter 2007-05-06 743 {
98f544695d3d3b Oliver Glitta 2021-03-30 @744 if (!(s->flags && SLAB_SILENT_ERRORS)) {
^^
& was intended instead of &&
3dc5063786b273 Christoph Lameter 2008-04-23 745 slab_bug(s, "%s", reason);
2492268472e7d3 Christoph Lameter 2007-07-17 746 print_trailer(s, page, object);
81819f0fc8285a Christoph Lameter 2007-05-06 747 }
98f544695d3d3b Oliver Glitta 2021-03-30 748 }
81819f0fc8285a Christoph Lameter 2007-05-06 749
a38965bf941b7c Mathieu Malaterre 2018-06-07 750 static __printf(3, 4) void slab_err(struct kmem_cache *s, struct page *page,
d0e0ac9772f8ec Chen Gang 2013-07-15 751 const char *fmt, ...)
81819f0fc8285a Christoph Lameter 2007-05-06 752 {
81819f0fc8285a Christoph Lameter 2007-05-06 753 va_list args;
81819f0fc8285a Christoph Lameter 2007-05-06 754 char buf[100];
81819f0fc8285a Christoph Lameter 2007-05-06 755
2492268472e7d3 Christoph Lameter 2007-07-17 756 va_start(args, fmt);
2492268472e7d3 Christoph Lameter 2007-07-17 757 vsnprintf(buf, sizeof(buf), fmt, args);
81819f0fc8285a Christoph Lameter 2007-05-06 758 va_end(args);
98f544695d3d3b Oliver Glitta 2021-03-30 @759 if (!(s->flags && SLAB_SILENT_ERRORS)) {
^^^^^^^^^^^^^^^^^^^^^
3dc5063786b273 Christoph Lameter 2008-04-23 760 slab_bug(s, "%s", buf);
2492268472e7d3 Christoph Lameter 2007-07-17 761 print_page_info(page);
81819f0fc8285a Christoph Lameter 2007-05-06 762 dump_stack();
81819f0fc8285a Christoph Lameter 2007-05-06 763 }
98f544695d3d3b Oliver Glitta 2021-03-30 764 }
81819f0fc8285a Christoph Lameter 2007-05-06 765
f7cb1933621bce Christoph Lameter 2010-09-29 766 static void init_object(struct kmem_cache *s, void *object, u8 val)
81819f0fc8285a Christoph Lameter 2007-05-06 767 {
aa1ef4d7b3f67f Andrey Konovalov 2020-12-22 768 u8 *p = kasan_reset_tag(object);
81819f0fc8285a Christoph Lameter 2007-05-06 769
d86bd1bece6fc4 Joonsoo Kim 2016-03-15 770 if (s->flags & SLAB_RED_ZONE)
d86bd1bece6fc4 Joonsoo Kim 2016-03-15 771 memset(p - s->red_left_pad, val, s->red_left_pad);
d86bd1bece6fc4 Joonsoo Kim 2016-03-15 772
81819f0fc8285a Christoph Lameter 2007-05-06 773 if (s->flags & __OBJECT_POISON) {
3b0efdfa1e7193 Christoph Lameter 2012-06-13 774 memset(p, POISON_FREE, s->object_size - 1);
3b0efdfa1e7193 Christoph Lameter 2012-06-13 775 p[s->object_size - 1] = POISON_END;
81819f0fc8285a Christoph Lameter 2007-05-06 776 }
81819f0fc8285a Christoph Lameter 2007-05-06 777
81819f0fc8285a Christoph Lameter 2007-05-06 778 if (s->flags & SLAB_RED_ZONE)
3b0efdfa1e7193 Christoph Lameter 2012-06-13 779 memset(p + s->object_size, val, s->inuse - s->object_size);
81819f0fc8285a Christoph Lameter 2007-05-06 780 }
81819f0fc8285a Christoph Lameter 2007-05-06 781
2492268472e7d3 Christoph Lameter 2007-07-17 782 static void restore_bytes(struct kmem_cache *s, char *message, u8 data,
2492268472e7d3 Christoph Lameter 2007-07-17 783 void *from, void *to)
2492268472e7d3 Christoph Lameter 2007-07-17 784 {
2492268472e7d3 Christoph Lameter 2007-07-17 785 slab_fix(s, "Restoring 0x%p-0x%p=0x%x\n", from, to - 1, data);
2492268472e7d3 Christoph Lameter 2007-07-17 786 memset(from, data, to - from);
2492268472e7d3 Christoph Lameter 2007-07-17 787 }
2492268472e7d3 Christoph Lameter 2007-07-17 788
2492268472e7d3 Christoph Lameter 2007-07-17 789 static int check_bytes_and_report(struct kmem_cache *s, struct page *page,
2492268472e7d3 Christoph Lameter 2007-07-17 790 u8 *object, char *what,
2492268472e7d3 Christoph Lameter 2007-07-17 791 u8 *start, unsigned int value, unsigned int bytes)
2492268472e7d3 Christoph Lameter 2007-07-17 792 {
2492268472e7d3 Christoph Lameter 2007-07-17 793 u8 *fault;
2492268472e7d3 Christoph Lameter 2007-07-17 794 u8 *end;
e1b70dd1e6429f Miles Chen 2019-11-30 795 u8 *addr = page_address(page);
2492268472e7d3 Christoph Lameter 2007-07-17 796
a79316c6178ca4 Andrey Ryabinin 2015-02-13 797 metadata_access_enable();
aa1ef4d7b3f67f Andrey Konovalov 2020-12-22 798 fault = memchr_inv(kasan_reset_tag(start), value, bytes);
a79316c6178ca4 Andrey Ryabinin 2015-02-13 799 metadata_access_disable();
2492268472e7d3 Christoph Lameter 2007-07-17 800 if (!fault)
81819f0fc8285a Christoph Lameter 2007-05-06 801 return 1;
2492268472e7d3 Christoph Lameter 2007-07-17 802
2492268472e7d3 Christoph Lameter 2007-07-17 803 end = start + bytes;
2492268472e7d3 Christoph Lameter 2007-07-17 804 while (end > fault && end[-1] == value)
2492268472e7d3 Christoph Lameter 2007-07-17 805 end--;
2492268472e7d3 Christoph Lameter 2007-07-17 806
98f544695d3d3b Oliver Glitta 2021-03-30 @807 if (!(s->flags && SLAB_SILENT_ERRORS)) {
^^^^^^^^^^^^^^^^^^^^^
2492268472e7d3 Christoph Lameter 2007-07-17 808 slab_bug(s, "%s overwritten", what);
e1b70dd1e6429f Miles Chen 2019-11-30 809 pr_err("INFO: 0x%p-0x%p @offset=%tu. First byte 0x%x instead of 0x%x\n",
e1b70dd1e6429f Miles Chen 2019-11-30 810 fault, end - 1, fault - addr,
e1b70dd1e6429f Miles Chen 2019-11-30 811 fault[0], value);
2492268472e7d3 Christoph Lameter 2007-07-17 812 print_trailer(s, page, object);
98f544695d3d3b Oliver Glitta 2021-03-30 813 }
2492268472e7d3 Christoph Lameter 2007-07-17 814
2492268472e7d3 Christoph Lameter 2007-07-17 815 restore_bytes(s, what, value, fault, end);
2492268472e7d3 Christoph Lameter 2007-07-17 816 return 0;
81819f0fc8285a Christoph Lameter 2007-05-06 817 }
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
Download attachment ".config.gz" of type "application/gzip" (32479 bytes)
Powered by blists - more mailing lists