linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [linux-next:master 2780/3509] lib/zstd/compress/huf_compress.c:460 HUF_getIndex() warn: the 'RANK_POSITION_LOG_BUCKETS_BEGIN' macro might need parens
@ 2022-10-27  7:59 Dan Carpenter
  2022-10-27 18:01 ` Nick Terrell
  0 siblings, 1 reply; 2+ messages in thread
From: Dan Carpenter @ 2022-10-27  7:59 UTC (permalink / raw)
  To: oe-kbuild, Nick Terrell; +Cc: lkp, oe-kbuild-all, Linux Memory Management List

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git master
head:   60eac8672b5b6061ec07499c0f1b79f6d94311ce
commit: 2aa14b1ab2c41a4fe41efae80d58bb77da91f19f [2780/3509] zstd: import usptream v1.5.2
config: i386-randconfig-m021
compiler: gcc-11 (Debian 11.3.0-8) 11.3.0

If you fix the issue, kindly add following tag where applicable
| Reported-by: kernel test robot <lkp@intel.com>
| Reported-by: Dan Carpenter <dan.carpenter@oracle.com>

smatch warnings:
lib/zstd/compress/huf_compress.c:460 HUF_getIndex() warn: the 'RANK_POSITION_LOG_BUCKETS_BEGIN' macro might need parens
lib/zstd/compress/huf_compress.c:460 HUF_getIndex() warn: the 'RANK_POSITION_LOG_BUCKETS_BEGIN' macro might need parens
lib/zstd/decompress/zstd_decompress_internal.h:206 ZSTD_DCtx_get_bmi2() warn: inconsistent indenting
lib/zstd/decompress/zstd_decompress_block.c:894 ZSTD_execSequenceEnd() warn: inconsistent indenting
lib/zstd/decompress/zstd_decompress_block.c:942 ZSTD_execSequenceEndSplitLitBuffer() warn: inconsistent indenting
lib/zstd/decompress/zstd_decompress_block.c:1009 ZSTD_execSequence() warn: inconsistent indenting

vim +/RANK_POSITION_LOG_BUCKETS_BEGIN +460 lib/zstd/compress/huf_compress.c

2aa14b1ab2c41a Nick Terrell 2022-10-17  457  static U32 HUF_getIndex(U32 const count) {
2aa14b1ab2c41a Nick Terrell 2022-10-17  458      return (count < RANK_POSITION_DISTINCT_COUNT_CUTOFF)
2aa14b1ab2c41a Nick Terrell 2022-10-17  459          ? count
2aa14b1ab2c41a Nick Terrell 2022-10-17 @460          : BIT_highbit32(count) + RANK_POSITION_LOG_BUCKETS_BEGIN;

These sorts of bugs where we're missing a () around a macro are very
rare in the kernel so it's a real treat to find one.  :)  It's harmless
in this case because the math works out the same either way.

2aa14b1ab2c41a Nick Terrell 2022-10-17  461  }

-- 
0-DAY CI Kernel Test Service
https://01.org/lkp




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

* Re: [linux-next:master 2780/3509] lib/zstd/compress/huf_compress.c:460 HUF_getIndex() warn: the 'RANK_POSITION_LOG_BUCKETS_BEGIN' macro might need parens
  2022-10-27  7:59 [linux-next:master 2780/3509] lib/zstd/compress/huf_compress.c:460 HUF_getIndex() warn: the 'RANK_POSITION_LOG_BUCKETS_BEGIN' macro might need parens Dan Carpenter
@ 2022-10-27 18:01 ` Nick Terrell
  0 siblings, 0 replies; 2+ messages in thread
From: Nick Terrell @ 2022-10-27 18:01 UTC (permalink / raw)
  To: Dan Carpenter
  Cc: oe-kbuild, kernel test robot, oe-kbuild-all,
	Linux Memory Management List



> On Oct 27, 2022, at 12:59 AM, Dan Carpenter <dan.carpenter@oracle.com> wrote:
> 
> !-------------------------------------------------------------------|
>  This Message Is From an External Sender
> 
> |-------------------------------------------------------------------!
> 
> tree:   https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git master
> head:   60eac8672b5b6061ec07499c0f1b79f6d94311ce
> commit: 2aa14b1ab2c41a4fe41efae80d58bb77da91f19f [2780/3509] zstd: import usptream v1.5.2
> config: i386-randconfig-m021
> compiler: gcc-11 (Debian 11.3.0-8) 11.3.0
> 
> If you fix the issue, kindly add following tag where applicable
> | Reported-by: kernel test robot <lkp@intel.com>
> | Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
> 
> smatch warnings:
> lib/zstd/compress/huf_compress.c:460 HUF_getIndex() warn: the 'RANK_POSITION_LOG_BUCKETS_BEGIN' macro might need parens
> lib/zstd/compress/huf_compress.c:460 HUF_getIndex() warn: the 'RANK_POSITION_LOG_BUCKETS_BEGIN' macro might need parens
> lib/zstd/decompress/zstd_decompress_internal.h:206 ZSTD_DCtx_get_bmi2() warn: inconsistent indenting
> lib/zstd/decompress/zstd_decompress_block.c:894 ZSTD_execSequenceEnd() warn: inconsistent indenting
> lib/zstd/decompress/zstd_decompress_block.c:942 ZSTD_execSequenceEndSplitLitBuffer() warn: inconsistent indenting
> lib/zstd/decompress/zstd_decompress_block.c:1009 ZSTD_execSequence() warn: inconsistent indenting
> 
> vim +/RANK_POSITION_LOG_BUCKETS_BEGIN +460 lib/zstd/compress/huf_compress.c
> 
> 2aa14b1ab2c41a Nick Terrell 2022-10-17  457  static U32 HUF_getIndex(U32 const count) {
> 2aa14b1ab2c41a Nick Terrell 2022-10-17  458      return (count < RANK_POSITION_DISTINCT_COUNT_CUTOFF)
> 2aa14b1ab2c41a Nick Terrell 2022-10-17  459          ? count
> 2aa14b1ab2c41a Nick Terrell 2022-10-17 @460          : BIT_highbit32(count) + RANK_POSITION_LOG_BUCKETS_BEGIN;
> 
> These sorts of bugs where we're missing a () around a macro are very
> rare in the kernel so it's a real treat to find one.  :)  It's harmless
> in this case because the math works out the same either way.

Nice catch! Filed an issue upstream [0] to fix that. Will backport the fix & add it to the patch series.

Best,
Nick Terrell

[0] https://github.com/facebook/zstd/issues/3301

> 2aa14b1ab2c41a Nick Terrell 2022-10-17  461  }
> 
> -- 
> 0-DAY CI Kernel Test Service
> https://01.org/lkp  
> 
> 



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

end of thread, other threads:[~2022-10-27 18:01 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-10-27  7:59 [linux-next:master 2780/3509] lib/zstd/compress/huf_compress.c:460 HUF_getIndex() warn: the 'RANK_POSITION_LOG_BUCKETS_BEGIN' macro might need parens Dan Carpenter
2022-10-27 18:01 ` Nick Terrell

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox