lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [day] [month] [year] [list]
Date:   Sun, 26 Nov 2017 03:29:30 +0800
From:   kbuild test robot <fengguang.wu@...el.com>
To:     Nick Terrell <terrelln@...com>
Cc:     kbuild-all@...org, linux-kernel@...r.kernel.org,
        Chris Mason <chris.mason@...ionio.com>,
        Chris Mason <clm@...com>
Subject: lib/zstd/decompress.c:416:2: warning: argument 1 null where non-null
 expected

Hi Nick,

First bad commit (maybe != root cause):

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   844056fd74ebdd826bd23a7d989597e15f478acb
commit: 5c1aab1dd5445ed8bdcdbb575abc1b0d7ee5b2e7 btrfs: Add zstd support
date:   3 months ago
config: x86_64-randconfig-h0-11260236 (attached as .config)
compiler: gcc-7 (Debian 7.2.0-12) 7.2.1 20171025
reproduce:
        git checkout 5c1aab1dd5445ed8bdcdbb575abc1b0d7ee5b2e7
        # save the attached .config to linux build tree
        make ARCH=x86_64 

All warnings (new ones prefixed by >>):

   Cyclomatic Complexity 1 lib/zstd/error_private.h:ERR_isError
   Cyclomatic Complexity 1 include/uapi/linux/byteorder/little_endian.h:__le64_to_cpup
   Cyclomatic Complexity 1 include/uapi/linux/byteorder/little_endian.h:__le32_to_cpup
   Cyclomatic Complexity 1 include/uapi/linux/byteorder/little_endian.h:__le16_to_cpup
   Cyclomatic Complexity 1 include/linux/unaligned/access_ok.h:get_unaligned_le16
   Cyclomatic Complexity 1 include/linux/unaligned/access_ok.h:get_unaligned_le32
   Cyclomatic Complexity 1 include/linux/unaligned/access_ok.h:get_unaligned_le64
   Cyclomatic Complexity 1 lib/zstd/mem.h:ZSTD_32bits
   Cyclomatic Complexity 1 lib/zstd/mem.h:ZSTD_readLE16
   Cyclomatic Complexity 1 lib/zstd/mem.h:ZSTD_readLE24
   Cyclomatic Complexity 1 lib/zstd/mem.h:ZSTD_readLE32
   Cyclomatic Complexity 1 lib/zstd/mem.h:ZSTD_readLE64
   Cyclomatic Complexity 2 lib/zstd/mem.h:ZSTD_readLEST
   Cyclomatic Complexity 1 lib/zstd/bitstream.h:BIT_lookBits
   Cyclomatic Complexity 1 lib/zstd/bitstream.h:BIT_lookBitsFast
   Cyclomatic Complexity 1 lib/zstd/bitstream.h:BIT_skipBits
   Cyclomatic Complexity 1 lib/zstd/bitstream.h:BIT_readBits
   Cyclomatic Complexity 1 lib/zstd/bitstream.h:BIT_readBitsFast
   Cyclomatic Complexity 1 lib/zstd/fse.h:FSE_peekSymbol
   Cyclomatic Complexity 1 lib/zstd/fse.h:FSE_updateState
   Cyclomatic Complexity 1 lib/zstd/zstd_internal.h:ZSTD_copy8
   Cyclomatic Complexity 1 lib/zstd/decompress.c:ZSTD_copy4
   Cyclomatic Complexity 31 lib/zstd/decompress.c:ZSTD_execSequence
   Cyclomatic Complexity 32 lib/zstd/decompress.c:ZSTD_decodeSequenceLong_generic
   Cyclomatic Complexity 31 lib/zstd/decompress.c:ZSTD_execSequenceLong
   Cyclomatic Complexity 1 lib/zstd/decompress.c:ZSTD_refDictContent
   Cyclomatic Complexity 1 lib/zstd/decompress.c:ZSTD_DDictDictContent
   Cyclomatic Complexity 1 lib/zstd/decompress.c:ZSTD_DDictDictSize
   Cyclomatic Complexity 1 lib/zstd/decompress.c:ZSTD_limitCopy
   Cyclomatic Complexity 4 lib/zstd/decompress.c:ZSTD_frameHeaderSize
   Cyclomatic Complexity 3 lib/zstd/decompress.c:ZSTD_checkContinuity
   Cyclomatic Complexity 11 lib/zstd/bitstream.h:BIT_reloadDStream
   Cyclomatic Complexity 1 lib/zstd/fse.h:FSE_initDState
   Cyclomatic Complexity 4 lib/zstd/zstd_internal.h:ZSTD_wildcopy
   Cyclomatic Complexity 20 lib/zstd/decompress.c:ZSTD_decodeSequence
   Cyclomatic Complexity 3 lib/zstd/decompress.c:ZSTD_copyRawBlock
   Cyclomatic Complexity 5 lib/zstd/decompress.c:ZSTD_setRleBlock
   Cyclomatic Complexity 15 lib/zstd/decompress.c:ZSTD_buildSeqTable
   Cyclomatic Complexity 1 lib/zstd/bitstream.h:BIT_highbit32
   Cyclomatic Complexity 17 lib/zstd/bitstream.h:BIT_initDStream
   Cyclomatic Complexity 1 lib/zstd/zstd_internal.h:ZSTD_highbit32
   Cyclomatic Complexity 3 lib/zstd/decompress.c:ZSTD_decodeSequenceLong
   Cyclomatic Complexity 17 lib/zstd/decompress.c:ZSTD_execSequenceLast7
   Cyclomatic Complexity 27 lib/zstd/decompress.c:ZSTD_loadEntropy
   Cyclomatic Complexity 6 lib/zstd/decompress.c:ZSTD_decompress_insertDictionary
   Cyclomatic Complexity 6 lib/zstd/decompress.c:ZSTD_loadEntropy_inDDict
   Cyclomatic Complexity 1 lib/zstd/decompress.c:ZSTD_DCtxWorkspaceBound
   Cyclomatic Complexity 1 lib/zstd/decompress.c:ZSTD_decompressBegin
   Cyclomatic Complexity 5 lib/zstd/decompress.c:ZSTD_refDDict
   Cyclomatic Complexity 11 lib/zstd/decompress.c:ZSTD_createDCtx_advanced
   Cyclomatic Complexity 1 lib/zstd/decompress.c:ZSTD_initDCtx
   Cyclomatic Complexity 3 lib/zstd/decompress.c:ZSTD_freeDCtx
   Cyclomatic Complexity 1 lib/zstd/decompress.c:ZSTD_copyDCtx
   Cyclomatic Complexity 7 lib/zstd/decompress.c:ZSTD_isFrame
   Cyclomatic Complexity 27 lib/zstd/decompress.c:ZSTD_getFrameParams
   Cyclomatic Complexity 14 lib/zstd/decompress.c:ZSTD_decodeFrameHeader
   Cyclomatic Complexity 6 lib/zstd/decompress.c:ZSTD_getFrameContentSize
   Cyclomatic Complexity 7 lib/zstd/decompress.c:ZSTD_getcBlockSize
   Cyclomatic Complexity 35 lib/zstd/decompress.c:ZSTD_decodeLiteralsBlock
   Cyclomatic Complexity 18 lib/zstd/decompress.c:ZSTD_decodeSeqHeaders
   Cyclomatic Complexity 20 lib/zstd/decompress.c:ZSTD_decompressSequencesLong
   Cyclomatic Complexity 14 lib/zstd/decompress.c:ZSTD_decompressSequences
   Cyclomatic Complexity 6 lib/zstd/decompress.c:ZSTD_decompressBlock_internal
   Cyclomatic Complexity 1 lib/zstd/decompress.c:ZSTD_decompressBlock
   Cyclomatic Complexity 1 lib/zstd/decompress.c:ZSTD_insertBlock
   Cyclomatic Complexity 3 lib/zstd/decompress.c:ZSTD_generateNxBytes
   Cyclomatic Complexity 24 lib/zstd/decompress.c:ZSTD_decompressFrame
   Cyclomatic Complexity 17 lib/zstd/decompress.c:ZSTD_findFrameCompressedSize
   Cyclomatic Complexity 15 lib/zstd/decompress.c:ZSTD_findDecompressedSize
   Cyclomatic Complexity 1 lib/zstd/decompress.c:ZSTD_nextSrcSizeToDecompress
   Cyclomatic Complexity 6 lib/zstd/decompress.c:ZSTD_nextInputType
   Cyclomatic Complexity 1 lib/zstd/decompress.c:ZSTD_isSkipFrame
   Cyclomatic Complexity 39 lib/zstd/decompress.c:ZSTD_decompressContinue
   Cyclomatic Complexity 5 lib/zstd/decompress.c:ZSTD_decompressBegin_usingDict
   Cyclomatic Complexity 20 lib/zstd/decompress.c:ZSTD_decompressMultiFrame
   Cyclomatic Complexity 1 lib/zstd/decompress.c:ZSTD_decompress_usingDict
   Cyclomatic Complexity 1 lib/zstd/decompress.c:ZSTD_decompressDCtx
   Cyclomatic Complexity 1 lib/zstd/decompress.c:ZSTD_DDictWorkspaceBound
   Cyclomatic Complexity 3 lib/zstd/decompress.c:ZSTD_freeDDict
   Cyclomatic Complexity 22 lib/zstd/decompress.c:ZSTD_createDDict_advanced
   Cyclomatic Complexity 1 lib/zstd/decompress.c:ZSTD_initDDict
   Cyclomatic Complexity 4 lib/zstd/decompress.c:ZSTD_getDictID_fromDict
   Cyclomatic Complexity 3 lib/zstd/decompress.c:ZSTD_getDictID_fromDDict
   Cyclomatic Complexity 2 lib/zstd/decompress.c:ZSTD_getDictID_fromFrame
   Cyclomatic Complexity 1 lib/zstd/decompress.c:ZSTD_decompress_usingDDict
   Cyclomatic Complexity 1 lib/zstd/decompress.c:ZSTD_DStreamWorkspaceBound
   Cyclomatic Complexity 3 lib/zstd/decompress.c:ZSTD_freeDStream
   Cyclomatic Complexity 13 lib/zstd/decompress.c:ZSTD_createDStream_advanced
   Cyclomatic Complexity 11 lib/zstd/decompress.c:ZSTD_initDStream
   Cyclomatic Complexity 3 lib/zstd/decompress.c:ZSTD_initDStream_usingDDict
   Cyclomatic Complexity 1 lib/zstd/decompress.c:ZSTD_DStreamInSize
   Cyclomatic Complexity 1 lib/zstd/decompress.c:ZSTD_DStreamOutSize
   Cyclomatic Complexity 1 lib/zstd/decompress.c:ZSTD_resetDStream
   Cyclomatic Complexity 68 lib/zstd/decompress.c:ZSTD_decompressStream
   lib/zstd/decompress.c: In function 'ZSTD_decompressStream':
>> lib/zstd/decompress.c:416:2: warning: argument 1 null where non-null expected [-Wnonnull]
     memcpy(dst, src, srcSize);
     ^~~~~~~~~~~~~~~~~~~~~~~~~
   In file included from arch/x86/include/asm/string.h:4:0,
                    from include/linux/string.h:18,
                    from lib/zstd/mem.h:24,
                    from lib/zstd/bitstream.h:54,
                    from lib/zstd/fse.h:228,
                    from lib/zstd/decompress.c:32:
   arch/x86/include/asm/string_64.h:31:14: note: in a call to function 'memcpy' declared here
    extern void *memcpy(void *to, const void *from, size_t len);
                 ^~~~~~
   lib/zstd/decompress.c:426:2: warning: argument 1 null where non-null expected [-Wnonnull]
     memset(dst, *(const BYTE *)src, regenSize);
     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   In file included from arch/x86/include/asm/string.h:4:0,
                    from include/linux/string.h:18,
                    from lib/zstd/mem.h:24,
                    from lib/zstd/bitstream.h:54,
                    from lib/zstd/fse.h:228,
                    from lib/zstd/decompress.c:32:
   arch/x86/include/asm/string_64.h:58:7: note: in a call to function 'memset' declared here
    void *memset(void *s, int c, size_t n);
          ^~~~~~
>> lib/zstd/decompress.c:416:2: warning: argument 1 null where non-null expected [-Wnonnull]
     memcpy(dst, src, srcSize);
     ^~~~~~~~~~~~~~~~~~~~~~~~~
   In file included from arch/x86/include/asm/string.h:4:0,
                    from include/linux/string.h:18,
                    from lib/zstd/mem.h:24,
                    from lib/zstd/bitstream.h:54,
                    from lib/zstd/fse.h:228,
                    from lib/zstd/decompress.c:32:
   arch/x86/include/asm/string_64.h:31:14: note: in a call to function 'memcpy' declared here
    extern void *memcpy(void *to, const void *from, size_t len);
                 ^~~~~~
   lib/zstd/decompress.c:426:2: warning: argument 1 null where non-null expected [-Wnonnull]
     memset(dst, *(const BYTE *)src, regenSize);
     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   In file included from arch/x86/include/asm/string.h:4:0,
                    from include/linux/string.h:18,
                    from lib/zstd/mem.h:24,
                    from lib/zstd/bitstream.h:54,
                    from lib/zstd/fse.h:228,
                    from lib/zstd/decompress.c:32:
   arch/x86/include/asm/string_64.h:58:7: note: in a call to function 'memset' declared here
    void *memset(void *s, int c, size_t n);
          ^~~~~~

vim +416 lib/zstd/decompress.c

73f3d1b4 Nick Terrell 2017-08-09  411  
73f3d1b4 Nick Terrell 2017-08-09  412  static size_t ZSTD_copyRawBlock(void *dst, size_t dstCapacity, const void *src, size_t srcSize)
73f3d1b4 Nick Terrell 2017-08-09  413  {
73f3d1b4 Nick Terrell 2017-08-09  414  	if (srcSize > dstCapacity)
73f3d1b4 Nick Terrell 2017-08-09  415  		return ERROR(dstSize_tooSmall);
73f3d1b4 Nick Terrell 2017-08-09 @416  	memcpy(dst, src, srcSize);
73f3d1b4 Nick Terrell 2017-08-09  417  	return srcSize;
73f3d1b4 Nick Terrell 2017-08-09  418  }
73f3d1b4 Nick Terrell 2017-08-09  419  

:::::: The code at line 416 was first introduced by commit
:::::: 73f3d1b48f5069d46ba48aa28c2898dc93185560 lib: Add zstd modules

:::::: TO: Nick Terrell <terrelln@...com>
:::::: CC: Chris Mason <clm@...com>

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

Download attachment ".config.gz" of type "application/gzip" (24267 bytes)

Powered by blists - more mailing lists