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>] [day] [month] [year] [list]
Message-ID: <20190408062803.GB6070@kadam>
Date:   Mon, 8 Apr 2019 09:28:03 +0300
From:   Dan Carpenter <dan.carpenter@...cle.com>
To:     kbuild@...org, Olaf Weber <olaf@....com>
Cc:     kbuild-all@...org, linux-ext4@...r.kernel.org,
        "Theodore Ts'o" <tytso@....edu>,
        Gabriel Krisman Bertazi <krisman@...labora.co.uk>
Subject: [ext4:unicode 2/10] fs/unicode/utf8-norm.c:199 utf8nlookup() warn:
 variable dereferenced before check 'data' (see line 193)

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/tytso/ext4.git unicode
head:   c0ae3a05c89c497446d6e208b68623993b5afc3c
commit: e57d9d28d2810e8db572cb2720fd6024c0b11de4 [2/10] unicode: introduce code for UTF-8 normalization

smatch warnings:
fs/unicode/utf8-norm.c:199 utf8nlookup() warn: variable dereferenced before check 'data' (see line 193)

# https://git.kernel.org/pub/scm/linux/kernel/git/tytso/ext4.git/commit/?id=e57d9d28d2810e8db572cb2720fd6024c0b11de4
git remote add ext4 https://git.kernel.org/pub/scm/linux/kernel/git/tytso/ext4.git
git remote update ext4
git checkout e57d9d28d2810e8db572cb2720fd6024c0b11de4
vim +/data +199 fs/unicode/utf8-norm.c

e57d9d28 Olaf Weber 2019-03-18  181  
e57d9d28 Olaf Weber 2019-03-18  182  /*
e57d9d28 Olaf Weber 2019-03-18  183   * Use trie to scan s, touching at most len bytes.
e57d9d28 Olaf Weber 2019-03-18  184   * Returns the leaf if one exists, NULL otherwise.
e57d9d28 Olaf Weber 2019-03-18  185   *
e57d9d28 Olaf Weber 2019-03-18  186   * A non-NULL return guarantees that the UTF-8 sequence starting at s
e57d9d28 Olaf Weber 2019-03-18  187   * is well-formed and corresponds to a known unicode code point.  The
e57d9d28 Olaf Weber 2019-03-18  188   * shorthand for this will be "is valid UTF-8 unicode".
e57d9d28 Olaf Weber 2019-03-18  189   */
e57d9d28 Olaf Weber 2019-03-18  190  static utf8leaf_t *utf8nlookup(const struct utf8data *data, const char *s,
e57d9d28 Olaf Weber 2019-03-18  191  			       size_t len)
e57d9d28 Olaf Weber 2019-03-18  192  {
e57d9d28 Olaf Weber 2019-03-18 @193  	utf8trie_t	*trie = utf8data + data->offset;
                                                                           ^^^^^^^^^^^^

e57d9d28 Olaf Weber 2019-03-18  194  	int		offlen;
e57d9d28 Olaf Weber 2019-03-18  195  	int		offset;
e57d9d28 Olaf Weber 2019-03-18  196  	int		mask;
e57d9d28 Olaf Weber 2019-03-18  197  	int		node;
e57d9d28 Olaf Weber 2019-03-18  198  
e57d9d28 Olaf Weber 2019-03-18 @199  	if (!data)
                                             ^^^^
Too late.

e57d9d28 Olaf Weber 2019-03-18  200  		return NULL;
e57d9d28 Olaf Weber 2019-03-18  201  	if (len == 0)
e57d9d28 Olaf Weber 2019-03-18  202  		return NULL;
e57d9d28 Olaf Weber 2019-03-18  203  	node = 1;
e57d9d28 Olaf Weber 2019-03-18  204  	while (node) {

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