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] [day] [month] [year] [list]
Message-ID: <CAKYAXd-NNEXdHQQ9YnHgROFH24A7MQmBG8LCsHKudikDLk7imA@mail.gmail.com>
Date:   Tue, 2 May 2023 23:49:42 +0900
From:   Namjae Jeon <linkinjeon@...nel.org>
To:     Dan Carpenter <dan.carpenter@...aro.org>
Cc:     oe-kbuild@...ts.linux.dev, lkp@...el.com,
        oe-kbuild-all@...ts.linux.dev, linux-kernel@...r.kernel.org,
        Steve French <stfrench@...rosoft.com>
Subject: Re: fs/ksmbd/smb_common.c:350 smb1_allocate_rsp_buf() warn: Please
 consider using kzalloc instead of kmalloc

2023-05-02 20:31 GMT+09:00, Dan Carpenter <dan.carpenter@...aro.org>:
> tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
> master
> head:   d06f5a3f7140921ada47d49574ae6fa4de5e2a89
> commit: dc8289f912387c3bcfbc5d2db29c8947fa207c11 ksmbd: fix
> slab-out-of-bounds in init_smb2_rsp_hdr
> config: openrisc-randconfig-m041-20230423
> (https://download.01.org/0day-ci/archive/20230428/202304281001.oskkuJo0-lkp@intel.com/config)
> compiler: or1k-linux-gcc (GCC) 12.1.0
>
> If you fix the issue, kindly add following tag where applicable
> | Reported-by: kernel test robot <lkp@...el.com>
> | Reported-by: Dan Carpenter <error27@...il.com>
> | Link: https://lore.kernel.org/r/202304281001.oskkuJo0-lkp@intel.com/
>
> smatch warnings:
> fs/ksmbd/smb_common.c:350 smb1_allocate_rsp_buf() warn: Please consider
> using kzalloc instead of kmalloc
>
> vim +350 fs/ksmbd/smb_common.c
>
> dc8289f912387c Namjae Jeon 2023-04-01  348  static int
> smb1_allocate_rsp_buf(struct ksmbd_work *work)
> dc8289f912387c Namjae Jeon 2023-04-01  349  {
> dc8289f912387c Namjae Jeon 2023-04-01 @350  	work->response_buf =
> kmalloc(MAX_CIFS_SMALL_BUFFER_SIZE,
> dc8289f912387c Namjae Jeon 2023-04-01  351  			GFP_KERNEL | __GFP_ZERO);
>
> Someone else wrote this Smatch check to encourage people to use kzalloc()
> instead of __GFP_ZERO.  I try stay out of style debates.  :P
Okay. I will change it.

Thanks.
>
> dc8289f912387c Namjae Jeon 2023-04-01  352  	work->response_sz =
> MAX_CIFS_SMALL_BUFFER_SIZE;
> dc8289f912387c Namjae Jeon 2023-04-01  353
> dc8289f912387c Namjae Jeon 2023-04-01  354  	if (!work->response_buf) {
> dc8289f912387c Namjae Jeon 2023-04-01  355  		pr_err("Failed to allocate %u
> bytes buffer\n",
> dc8289f912387c Namjae Jeon 2023-04-01  356
> 				MAX_CIFS_SMALL_BUFFER_SIZE);
> dc8289f912387c Namjae Jeon 2023-04-01  357  		return -ENOMEM;
> dc8289f912387c Namjae Jeon 2023-04-01  358  	}
> dc8289f912387c Namjae Jeon 2023-04-01  359
> dc8289f912387c Namjae Jeon 2023-04-01  360  	return 0;
> dc8289f912387c Namjae Jeon 2023-04-01  361  }
>
> --
> 0-DAY CI Kernel Test Service
> https://github.com/intel/lkp-tests
>
>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ