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  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Tue, 22 Nov 2022 17:37:47 +0800
From:   kernel test robot <lkp@...el.com>
To:     Christian Schoenebeck <linux_oss@...debyte.com>,
        Dominique Martinet <asmadeus@...ewreck.org>,
        Stefano Stabellini <sstabellini@...nel.org>
Cc:     llvm@...ts.linux.dev, oe-kbuild-all@...ts.linux.dev,
        v9fs-developer@...ts.sourceforge.net, linux-kernel@...r.kernel.org,
        GUO Zihua <guozihua@...wei.com>
Subject: Re: [PATCH 2/2] net/9p: fix response size check in p9_check_errors()

Hi Christian,

I love your patch! Perhaps something to improve:

[auto build test WARNING on v6.1-rc6]
[also build test WARNING on linus/master next-20221122]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Christian-Schoenebeck/net-9p-fix-response-size-check-in-p9_check_errors/20221122-075849
patch link:    https://lore.kernel.org/r/fffb512c532bf1290f0f2b1df6068b2ff6cd14c0.1669072186.git.linux_oss%40crudebyte.com
patch subject: [PATCH 2/2] net/9p: fix response size check in p9_check_errors()
config: hexagon-randconfig-r041-20221120
compiler: clang version 16.0.0 (https://github.com/llvm/llvm-project af8c49dc1ec44339d915d988ffe0f38da68ca0e7)
reproduce (this is a W=1 build):
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # https://github.com/intel-lab-lkp/linux/commit/33e592d4a74029c0a04584fbc23c55a91fd28dcb
        git remote add linux-review https://github.com/intel-lab-lkp/linux
        git fetch --no-tags linux-review Christian-Schoenebeck/net-9p-fix-response-size-check-in-p9_check_errors/20221122-075849
        git checkout 33e592d4a74029c0a04584fbc23c55a91fd28dcb
        # save the config file
        mkdir build_dir && cp config build_dir/.config
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=hexagon SHELL=/bin/bash net/9p/

If you fix the issue, kindly add following tag where applicable
| Reported-by: kernel test robot <lkp@...el.com>

All warnings (new ones prefixed by >>):

   In file included from net/9p/client.c:29:
   In file included from include/trace/events/9p.h:222:
   In file included from include/trace/define_trace.h:102:
   In file included from include/trace/trace_events.h:21:
   In file included from include/linux/trace_events.h:9:
   In file included from include/linux/hardirq.h:11:
   In file included from ./arch/hexagon/include/generated/asm/hardirq.h:1:
   In file included from include/asm-generic/hardirq.h:17:
   In file included from include/linux/irq.h:20:
   In file included from include/linux/io.h:13:
   In file included from arch/hexagon/include/asm/io.h:334:
   include/asm-generic/io.h:547:31: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
           val = __raw_readb(PCI_IOBASE + addr);
                             ~~~~~~~~~~ ^
   include/asm-generic/io.h:560:61: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
           val = __le16_to_cpu((__le16 __force)__raw_readw(PCI_IOBASE + addr));
                                                           ~~~~~~~~~~ ^
   include/uapi/linux/byteorder/little_endian.h:37:51: note: expanded from macro '__le16_to_cpu'
   #define __le16_to_cpu(x) ((__force __u16)(__le16)(x))
                                                     ^
   In file included from net/9p/client.c:29:
   In file included from include/trace/events/9p.h:222:
   In file included from include/trace/define_trace.h:102:
   In file included from include/trace/trace_events.h:21:
   In file included from include/linux/trace_events.h:9:
   In file included from include/linux/hardirq.h:11:
   In file included from ./arch/hexagon/include/generated/asm/hardirq.h:1:
   In file included from include/asm-generic/hardirq.h:17:
   In file included from include/linux/irq.h:20:
   In file included from include/linux/io.h:13:
   In file included from arch/hexagon/include/asm/io.h:334:
   include/asm-generic/io.h:573:61: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
           val = __le32_to_cpu((__le32 __force)__raw_readl(PCI_IOBASE + addr));
                                                           ~~~~~~~~~~ ^
   include/uapi/linux/byteorder/little_endian.h:35:51: note: expanded from macro '__le32_to_cpu'
   #define __le32_to_cpu(x) ((__force __u32)(__le32)(x))
                                                     ^
   In file included from net/9p/client.c:29:
   In file included from include/trace/events/9p.h:222:
   In file included from include/trace/define_trace.h:102:
   In file included from include/trace/trace_events.h:21:
   In file included from include/linux/trace_events.h:9:
   In file included from include/linux/hardirq.h:11:
   In file included from ./arch/hexagon/include/generated/asm/hardirq.h:1:
   In file included from include/asm-generic/hardirq.h:17:
   In file included from include/linux/irq.h:20:
   In file included from include/linux/io.h:13:
   In file included from arch/hexagon/include/asm/io.h:334:
   include/asm-generic/io.h:584:33: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
           __raw_writeb(value, PCI_IOBASE + addr);
                               ~~~~~~~~~~ ^
   include/asm-generic/io.h:594:59: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
           __raw_writew((u16 __force)cpu_to_le16(value), PCI_IOBASE + addr);
                                                         ~~~~~~~~~~ ^
   include/asm-generic/io.h:604:59: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
           __raw_writel((u32 __force)cpu_to_le32(value), PCI_IOBASE + addr);
                                                         ~~~~~~~~~~ ^
>> net/9p/client.c:520:19: warning: format specifies type 'long' but the argument has type 'size_t' (aka 'unsigned int') [-Wformat]
                            req->rc.size, req->rc.capacity, req->rc.id);
                                          ^~~~~~~~~~~~~~~~
   include/linux/printk.h:500:33: note: expanded from macro 'pr_err'
           printk(KERN_ERR pr_fmt(fmt), ##__VA_ARGS__)
                                  ~~~     ^~~~~~~~~~~
   include/linux/printk.h:457:60: note: expanded from macro 'printk'
   #define printk(fmt, ...) printk_index_wrap(_printk, fmt, ##__VA_ARGS__)
                                                       ~~~    ^~~~~~~~~~~
   include/linux/printk.h:429:19: note: expanded from macro 'printk_index_wrap'
                   _p_func(_fmt, ##__VA_ARGS__);                           \
                           ~~~~    ^~~~~~~~~~~
   7 warnings generated.


vim +520 net/9p/client.c

   498	
   499	/**
   500	 * p9_check_errors - check 9p packet for error return and process it
   501	 * @c: current client instance
   502	 * @req: request to parse and check for error conditions
   503	 *
   504	 * returns error code if one is discovered, otherwise returns 0
   505	 *
   506	 * this will have to be more complicated if we have multiple
   507	 * error packet types
   508	 */
   509	
   510	static int p9_check_errors(struct p9_client *c, struct p9_req_t *req)
   511	{
   512		s8 type;
   513		int err;
   514		int ecode;
   515	
   516		err = p9_parse_header(&req->rc, NULL, &type, NULL, 0);
   517		if (req->rc.size > req->rc.capacity && !req->rc.zc) {
   518			pr_err(
   519				 "requested packet size too big: %d does not fit %ld (type=%d)\n",
 > 520				 req->rc.size, req->rc.capacity, req->rc.id);
   521			return -EIO;
   522		}
   523		/* dump the response from server
   524		 * This should be after check errors which poplulate pdu_fcall.
   525		 */
   526		trace_9p_protocol_dump(c, &req->rc);
   527		if (err) {
   528			p9_debug(P9_DEBUG_ERROR, "couldn't parse header %d\n", err);
   529			return err;
   530		}
   531		if (type != P9_RERROR && type != P9_RLERROR)
   532			return 0;
   533	
   534		if (!p9_is_proto_dotl(c)) {
   535			char *ename;
   536	
   537			err = p9pdu_readf(&req->rc, c->proto_version, "s?d",
   538					  &ename, &ecode);
   539			if (err)
   540				goto out_err;
   541	
   542			if (p9_is_proto_dotu(c) && ecode < 512)
   543				err = -ecode;
   544	
   545			if (!err) {
   546				err = p9_errstr2errno(ename, strlen(ename));
   547	
   548				p9_debug(P9_DEBUG_9P, "<<< RERROR (%d) %s\n",
   549					 -ecode, ename);
   550			}
   551			kfree(ename);
   552		} else {
   553			err = p9pdu_readf(&req->rc, c->proto_version, "d", &ecode);
   554			if (err)
   555				goto out_err;
   556			err = -ecode;
   557	
   558			p9_debug(P9_DEBUG_9P, "<<< RLERROR (%d)\n", -ecode);
   559		}
   560	
   561		return err;
   562	
   563	out_err:
   564		p9_debug(P9_DEBUG_ERROR, "couldn't parse error%d\n", err);
   565	
   566		return err;
   567	}
   568	

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

View attachment "config" of type "text/plain" (111603 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ