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, 16 Jan 2018 11:40:51 +0300
From:   Dan Carpenter <dan.carpenter@...cle.com>
To:     kbuild@...org, Xiongfeng Wang <wangxiongfeng2@...wei.com>
Cc:     kbuild-all@...org, miguel.ojeda.sandonis@...il.com,
        linux-kernel@...r.kernel.org, arnd@...db.de,
        wangxiongfeng2@...wei.com, Dan Carpenter <dan.carpenter@...cle.com>
Subject: Re: [PATCH] auxdisplay: use correct string length

[ The kbuild robot is being tweaked so the actual warnings are missing
  but it's easy enough to guess what it was - dan ]

Hi Xiongfeng,

Thank you for the patch! Perhaps something to improve:

url:    https://github.com/0day-ci/linux/commits/Xiongfeng-Wang/auxdisplay-use-correct-string-length/20180110-180916

# https://github.com/0day-ci/linux/commit/eab240fbc00377bf3e18428b401e651bd6296da0
git remote add linux-review https://github.com/0day-ci/linux
git remote update linux-review
git checkout eab240fbc00377bf3e18428b401e651bd6296da0
vim +1512 drivers/auxdisplay/panel.c

7005b5845 drivers/staging/panel/panel.c Willy Tarreau            2008-11-13  1483  
7005b5845 drivers/staging/panel/panel.c Willy Tarreau            2008-11-13  1484  /* tries to bind a key to the signal name <name>. The key will send the
7005b5845 drivers/staging/panel/panel.c Willy Tarreau            2008-11-13  1485   * strings <press>, <repeat>, <release> for these respective events.
7005b5845 drivers/staging/panel/panel.c Willy Tarreau            2008-11-13  1486   * Returns the pointer to the new key if ok, NULL if the key could not be bound.
7005b5845 drivers/staging/panel/panel.c Willy Tarreau            2008-11-13  1487   */
36d2041a3 drivers/staging/panel/panel.c Peter Huewe              2013-02-15  1488  static struct logical_input *panel_bind_key(const char *name, const char *press,
36d2041a3 drivers/staging/panel/panel.c Peter Huewe              2013-02-15  1489  					    const char *repeat,
36d2041a3 drivers/staging/panel/panel.c Peter Huewe              2013-02-15  1490  					    const char *release)
698b1515f drivers/staging/panel/panel.c Willy Tarreau            2008-11-22  1491  {
7005b5845 drivers/staging/panel/panel.c Willy Tarreau            2008-11-13  1492  	struct logical_input *key;
7005b5845 drivers/staging/panel/panel.c Willy Tarreau            2008-11-13  1493  
fdf4a4948 drivers/staging/panel/panel.c Dominique van den Broeck 2014-05-21  1494  	key = kzalloc(sizeof(*key), GFP_KERNEL);
eb073a9bf drivers/staging/panel/panel.c Toshiaki Yamane          2012-07-12  1495  	if (!key)
7005b5845 drivers/staging/panel/panel.c Willy Tarreau            2008-11-13  1496  		return NULL;
eb073a9bf drivers/staging/panel/panel.c Toshiaki Yamane          2012-07-12  1497  
698b1515f drivers/staging/panel/panel.c Willy Tarreau            2008-11-22  1498  	if (!input_name2mask(name, &key->mask, &key->value, &scan_mask_i,
cb46f472c drivers/staging/panel/panel.c Kulikov Vasiliy          2010-07-12  1499  			     &scan_mask_o)) {
cb46f472c drivers/staging/panel/panel.c Kulikov Vasiliy          2010-07-12  1500  		kfree(key);
7005b5845 drivers/staging/panel/panel.c Willy Tarreau            2008-11-13  1501  		return NULL;
cb46f472c drivers/staging/panel/panel.c Kulikov Vasiliy          2010-07-12  1502  	}
698b1515f drivers/staging/panel/panel.c Willy Tarreau            2008-11-22  1503  
7005b5845 drivers/staging/panel/panel.c Willy Tarreau            2008-11-13  1504  	key->type = INPUT_TYPE_KBD;
7005b5845 drivers/staging/panel/panel.c Willy Tarreau            2008-11-13  1505  	key->state = INPUT_ST_LOW;
7005b5845 drivers/staging/panel/panel.c Willy Tarreau            2008-11-13  1506  	key->rise_time = 1;
7005b5845 drivers/staging/panel/panel.c Willy Tarreau            2008-11-13  1507  	key->fall_time = 1;
7005b5845 drivers/staging/panel/panel.c Willy Tarreau            2008-11-13  1508  
eab240fbc drivers/auxdisplay/panel.c    Xiongfeng Wang           2018-01-08  1509  	strncpy(key->u.kbd.press_str, press, sizeof(key->u.kbd.press_str) - 1);
eab240fbc drivers/auxdisplay/panel.c    Xiongfeng Wang           2018-01-08  1510  	strncpy(key->u.kbd.repeat_str, repeat, sizeof(key->u.kbd.repeat_str) - 1);
698b1515f drivers/staging/panel/panel.c Willy Tarreau            2008-11-22  1511  	strncpy(key->u.kbd.release_str, release,
eab240fbc drivers/auxdisplay/panel.c    Xiongfeng Wang           2018-01-08 @1512  		sizeof(key->u.kbd.release_str - 1));
                                                                                                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
The " - 1" shouldn't be inside the sizeof().  It should be:

		sizeof(key->u.kbd.release_str) - 1);

7005b5845 drivers/staging/panel/panel.c Willy Tarreau            2008-11-13  1513  	list_add(&key->list, &logical_inputs);
7005b5845 drivers/staging/panel/panel.c Willy Tarreau            2008-11-13  1514  	return key;
7005b5845 drivers/staging/panel/panel.c Willy Tarreau            2008-11-13  1515  }
7005b5845 drivers/staging/panel/panel.c Willy Tarreau            2008-11-13  1516  

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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ