[ext4:unicode 2/10] fs/unicode/utf8-norm.c:199 utf8nlookup() warn: variable dereferenced before check 'data' (see line 193)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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



[Index of Archives]     [Reiser Filesystem Development]     [Ceph FS]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Linux FS]     [Yosemite National Park]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Device Mapper]     [Linux Media]

  Powered by Linux