All of lore.kernel.org
 help / color / mirror / Atom feed
* re: ext4 crypto: filename encryption modifications
@ 2015-05-12 12:17 Dan Carpenter
  0 siblings, 0 replies; only message in thread
From: Dan Carpenter @ 2015-05-12 12:17 UTC (permalink / raw)
  To: mhalcrow; +Cc: linux-ext4

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

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2015-05-12 12:17 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-05-12 12:17 ext4 crypto: filename encryption modifications Dan Carpenter

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.