mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Xiongfeng Wang <wangxiongfeng2@huawei.com>
To: Dan Carpenter <dan.carpenter@oracle.com>, <kbuild@01.org>
Cc: <kbuild-all@01.org>, <miguel.ojeda.sandonis@gmail.com>,
	<linux-kernel@vger.kernel.org>, <arnd@arndb.de>
Subject: Re: [PATCH] auxdisplay: use correct string length
Date: Tue, 16 Jan 2018 17:22:41 +0800	[thread overview]
Message-ID: <2e2c50d6-6fee-ac9d-6a7e-13838b69b5be@huawei.com> (raw)
In-Reply-To: <20180116084051.sdgqdzaqluasfofx@mwanda>



On 2018/1/16 16:40, Dan Carpenter wrote:
> [ 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);

Sure, thanks. I will change it in another version.

> 
> 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
> 
> .
> 

      reply	other threads:[~2018-01-16  9:22 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-01-08 12:08 Xiongfeng Wang
2018-01-16  8:40 ` Dan Carpenter
2018-01-16  9:22   ` Xiongfeng Wang [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=2e2c50d6-6fee-ac9d-6a7e-13838b69b5be@huawei.com \
    --to=wangxiongfeng2@huawei.com \
    --cc=arnd@arndb.de \
    --cc=dan.carpenter@oracle.com \
    --cc=kbuild-all@01.org \
    --cc=kbuild@01.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=miguel.ojeda.sandonis@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®