[<prev] [next>] [day] [month] [year] [list]
Message-ID: <20150512121713.GA31379@mwanda>
Date: Tue, 12 May 2015 15:17:14 +0300
From: Dan Carpenter <dan.carpenter@...cle.com>
To: mhalcrow@...gle.com
Cc: linux-ext4@...r.kernel.org
Subject: re: ext4 crypto: filename encryption modifications
Hello Michael Halcrow,
The patch 1f3862b5575b: "ext4 crypto: filename encryption
modifications" from Apr 12, 2015, leads to the following static
checker warning:
fs/ext4/namei.c:1269 ext4_search_dir()
warn: bool is not less than zero.
fs/ext4/namei.c
1264 while ((char *) de < dlimit) {
1265 /* this code is executed quadratically often */
1266 /* do minimal checking `by hand' */
1267 if ((char *) de + de->name_len <= dlimit) {
1268 res = ext4_match(fname, de);
1269 if (res < 0) {
^^^^^^^
The comments for ext4_match() say it only returns zero and one.
* NOTE! unlike strncmp, ext4_match returns 1 for success, 0 for failure.
So you could just do "if (ext4_match(fname, de)) {".
1270 res = -1;
1271 goto return_result;
1272 }
1273 if (res > 0) {
1274 /* found a match - just to be sure, do
1275 * a full check */
1276 if (ext4_check_dir_entry(dir, NULL, de, bh,
1277 bh->b_data,
1278 bh->b_size, offset)) {
1279 res = -1;
1280 goto return_result;
1281 }
1282 *res_dir = de;
1283 res = 1;
1284 goto return_result;
1285 }
regards,
dan carpenter
--
To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists