public inbox for linux-ext4@vger.kernel.org
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: kbuild@01.org, Olaf Weber <olaf@sgi.com>
Cc: kbuild-all@01.org, linux-ext4@vger.kernel.org,
	"Theodore Ts'o" <tytso@mit.edu>,
	Gabriel Krisman Bertazi <krisman@collabora.co.uk>
Subject: [ext4:unicode 2/10] fs/unicode/utf8-norm.c:199 utf8nlookup() warn: variable dereferenced before check 'data' (see line 193)
Date: Mon, 8 Apr 2019 09:28:03 +0300	[thread overview]
Message-ID: <20190408062803.GB6070@kadam> (raw)

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

                 reply	other threads:[~2019-04-08  6:28 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20190408062803.GB6070@kadam \
    --to=dan.carpenter@oracle.com \
    --cc=kbuild-all@01.org \
    --cc=kbuild@01.org \
    --cc=krisman@collabora.co.uk \
    --cc=linux-ext4@vger.kernel.org \
    --cc=olaf@sgi.com \
    --cc=tytso@mit.edu \
    /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