From: Dan Carpenter <dan.carpenter@oracle.com>
To: ocfs2-devel@oss.oracle.com
Subject: [Ocfs2-devel] [bug report] ocfs2: fix value of OCFS2_INVALID_SLOT
Date: Tue, 23 Jun 2020 14:05:58 +0300 [thread overview]
Message-ID: <20200623110558.GA27810@mwanda> (raw)
Hello Junxiao Bi,
The patch c824ce1feffa: "ocfs2: fix value of OCFS2_INVALID_SLOT" from
Jun 21, 2020, leads to the following static checker warning:
fs/ocfs2/super.c:1269 ocfs2_parse_options()
warn: '(-1)' 65535 can't fit into 32767 'mopt->slot'
fs/ocfs2/super.c
1253 static int ocfs2_parse_options(struct super_block *sb,
1254 char *options,
1255 struct mount_options *mopt,
1256 int is_remount)
1257 {
1258 int status, user_stack = 0;
1259 char *p;
1260 u32 tmp;
1261 int token, option;
1262 substring_t args[MAX_OPT_ARGS];
1263
1264 trace_ocfs2_parse_options(is_remount, options ? options : "(none)");
1265
1266 mopt->commit_interval = 0;
1267 mopt->mount_opt = OCFS2_MOUNT_NOINTR;
1268 mopt->atime_quantum = OCFS2_DEFAULT_ATIME_QUANTUM;
1269 mopt->slot = OCFS2_INVALID_SLOT;
^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^
OCFS2_INVALID_SLOT used to be -1, but the patch changed it to USHRT_MAX.
mopt->slot is a s16 so it becomes -1 again.
We assign it to osb->preferred_slot which is an int so it's still -1.
Then we do:
if (osb->preferred_slot != OCFS2_INVALID_SLOT)
Since -1 is not equal to USHRT_MAX then this condition is not true.
1270 mopt->localalloc_opt = -1;
1271 mopt->cluster_stack[0] = '\0';
1272 mopt->resv_level = OCFS2_DEFAULT_RESV_LEVEL;
1273 mopt->dir_resv_level = -1;
1274
1275 if (!options) {
1276 status = 1;
regards,
dan carpenter
next reply other threads:[~2020-06-23 11:05 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-06-23 11:05 Dan Carpenter [this message]
2020-06-23 20:26 ` [Ocfs2-devel] [bug report] ocfs2: fix value of OCFS2_INVALID_SLOT Junxiao Bi
2020-06-24 14:57 ` Dan Carpenter
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=20200623110558.GA27810@mwanda \
--to=dan.carpenter@oracle.com \
--cc=ocfs2-devel@oss.oracle.com \
/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).