linux-ext4.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: kbuild@01.org, Gabriel Krisman Bertazi <krisman@collabora.co.uk>
Cc: kbuild-all@01.org, linux-ext4@vger.kernel.org,
	"Theodore Ts'o" <tytso@mit.edu>
Subject: [ext4:unicode 4/10] fs/unicode/utf8-core.c:90 utf8_casefold() warn: impossible condition '(dest[nlen] == -1) => (0-255 == (-1))'
Date: Mon, 8 Apr 2019 09:29:20 +0300	[thread overview]
Message-ID: <20190408062919.GC6070@kadam> (raw)

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/tytso/ext4.git unicode
head:   c0ae3a05c89c497446d6e208b68623993b5afc3c
commit: 45568caefa60a247ce9ecee3f4a57d1f81f5dd0e [4/10] unicode: implement higher level API for string handling

smatch warnings:
fs/unicode/utf8-core.c:90 utf8_casefold() warn: impossible condition '(dest[nlen] == -1) => (0-255 == (-1))'
fs/unicode/utf8-core.c:112 utf8_normalize() warn: impossible condition '(dest[nlen] == -1) => (0-255 == (-1))'

# https://git.kernel.org/pub/scm/linux/kernel/git/tytso/ext4.git/commit/?id=45568caefa60a247ce9ecee3f4a57d1f81f5dd0e
git remote add ext4 https://git.kernel.org/pub/scm/linux/kernel/git/tytso/ext4.git
git remote update ext4
git checkout 45568caefa60a247ce9ecee3f4a57d1f81f5dd0e
vim +90 fs/unicode/utf8-core.c

45568cae Gabriel Krisman Bertazi 2019-03-18   75  
45568cae Gabriel Krisman Bertazi 2019-03-18   76  int utf8_casefold(const struct unicode_map *um, const struct qstr *str,
45568cae Gabriel Krisman Bertazi 2019-03-18   77  		  unsigned char *dest, size_t dlen)
45568cae Gabriel Krisman Bertazi 2019-03-18   78  {
45568cae Gabriel Krisman Bertazi 2019-03-18   79  	const struct utf8data *data = utf8nfdicf(um->version);
45568cae Gabriel Krisman Bertazi 2019-03-18   80  	struct utf8cursor cur;
45568cae Gabriel Krisman Bertazi 2019-03-18   81  	size_t nlen = 0;
45568cae Gabriel Krisman Bertazi 2019-03-18   82  
45568cae Gabriel Krisman Bertazi 2019-03-18   83  	if (utf8ncursor(&cur, data, str->name, str->len) < 0)
45568cae Gabriel Krisman Bertazi 2019-03-18   84  		return -EINVAL;
45568cae Gabriel Krisman Bertazi 2019-03-18   85  
45568cae Gabriel Krisman Bertazi 2019-03-18   86  	for (nlen = 0; nlen < dlen; nlen++) {
45568cae Gabriel Krisman Bertazi 2019-03-18   87  		dest[nlen] = utf8byte(&cur);
45568cae Gabriel Krisman Bertazi 2019-03-18   88  		if (!dest[nlen])
45568cae Gabriel Krisman Bertazi 2019-03-18   89  			return nlen;
45568cae Gabriel Krisman Bertazi 2019-03-18  @90  		if (dest[nlen] == -1)
                                                                    ^^^^^^^^^^^^^^^^

45568cae Gabriel Krisman Bertazi 2019-03-18   91  			break;
45568cae Gabriel Krisman Bertazi 2019-03-18   92  	}
45568cae Gabriel Krisman Bertazi 2019-03-18   93  	return -EINVAL;
45568cae Gabriel Krisman Bertazi 2019-03-18   94  }
45568cae Gabriel Krisman Bertazi 2019-03-18   95  
45568cae Gabriel Krisman Bertazi 2019-03-18   96  EXPORT_SYMBOL(utf8_casefold);
45568cae Gabriel Krisman Bertazi 2019-03-18   97  
45568cae Gabriel Krisman Bertazi 2019-03-18   98  int utf8_normalize(const struct unicode_map *um, const struct qstr *str,
45568cae Gabriel Krisman Bertazi 2019-03-18   99  		   unsigned char *dest, size_t dlen)
45568cae Gabriel Krisman Bertazi 2019-03-18  100  {
45568cae Gabriel Krisman Bertazi 2019-03-18  101  	const struct utf8data *data = utf8nfdi(um->version);
45568cae Gabriel Krisman Bertazi 2019-03-18  102  	struct utf8cursor cur;
45568cae Gabriel Krisman Bertazi 2019-03-18  103  	ssize_t nlen = 0;
45568cae Gabriel Krisman Bertazi 2019-03-18  104  
45568cae Gabriel Krisman Bertazi 2019-03-18  105  	if (utf8ncursor(&cur, data, str->name, str->len) < 0)
45568cae Gabriel Krisman Bertazi 2019-03-18  106  		return -EINVAL;
45568cae Gabriel Krisman Bertazi 2019-03-18  107  
45568cae Gabriel Krisman Bertazi 2019-03-18  108  	for (nlen = 0; nlen < dlen; nlen++) {
45568cae Gabriel Krisman Bertazi 2019-03-18  109  		dest[nlen] = utf8byte(&cur);
45568cae Gabriel Krisman Bertazi 2019-03-18  110  		if (!dest[nlen])
45568cae Gabriel Krisman Bertazi 2019-03-18  111  			return nlen;
45568cae Gabriel Krisman Bertazi 2019-03-18 @112  		if (dest[nlen] == -1)
                                                                    ^^^^^^^^^^^^^^^^

45568cae Gabriel Krisman Bertazi 2019-03-18  113  			break;
45568cae Gabriel Krisman Bertazi 2019-03-18  114  	}
45568cae Gabriel Krisman Bertazi 2019-03-18  115  	return -EINVAL;
45568cae Gabriel Krisman Bertazi 2019-03-18  116  }
45568cae Gabriel Krisman Bertazi 2019-03-18  117  

---
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:29 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=20190408062919.GC6070@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=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;
as well as URLs for NNTP newsgroup(s).