linux-ext4.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: krisman@collabora.com
Cc: linux-ext4@vger.kernel.org
Subject: [bug report] ext4: optimize case-insensitive lookups
Date: Mon, 24 Jun 2019 15:29:06 +0300	[thread overview]
Message-ID: <20190624122906.GA30836@mwanda> (raw)

Hello Gabriel Krisman Bertazi,

The patch 3ae72562ad91: "ext4: optimize case-insensitive lookups"
from Jun 19, 2019, leads to the following static checker warning:

	fs/ext4/namei.c:1311 ext4_fname_setup_ci_filename()
	warn: 'cf_name->len' unsigned <= 0

fs/ext4/namei.c
  1296  void ext4_fname_setup_ci_filename(struct inode *dir, const struct qstr *iname,
  1297                                    struct fscrypt_str *cf_name)
  1298  {
  1299          if (!IS_CASEFOLDED(dir)) {
  1300                  cf_name->name = NULL;
  1301                  return;
  1302          }
  1303  
  1304          cf_name->name = kmalloc(EXT4_NAME_LEN, GFP_NOFS);
  1305          if (!cf_name->name)
  1306                  return;
  1307  
  1308          cf_name->len = utf8_casefold(EXT4_SB(dir->i_sb)->s_encoding,
  1309                                       iname, cf_name->name,
  1310                                       EXT4_NAME_LEN);

utf8_casefold() returns negative error codes

  1311          if (cf_name->len <= 0) {

but "cf_name->len" is a u32.

  1312                  kfree(cf_name->name);
  1313                  cf_name->name = NULL;
  1314          }
  1315  }


regards,
dan carpenter

             reply	other threads:[~2019-06-24 12:29 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-06-24 12:29 Dan Carpenter [this message]
2019-06-28 20:19 ` [PATCH] ext4: Fix coverity warning on error path of filename setup Gabriel Krisman Bertazi
2019-07-02 21:57   ` Theodore Ts'o

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=20190624122906.GA30836@mwanda \
    --to=dan.carpenter@oracle.com \
    --cc=krisman@collabora.com \
    --cc=linux-ext4@vger.kernel.org \
    /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).