From: Jan Kara <jack@suse.cz>
To: Jeff Layton <jlayton@kernel.org>
Cc: Christian Brauner <brauner@kernel.org>, linux-fsdevel@vger.kernel.org
Subject: New Defects reported by Coverity Scan for linux-next weekly scan (fwd)
Date: Wed, 9 Oct 2024 17:30:22 +0200 [thread overview]
Message-ID: <20241009153022.5uyp6aku2kcfeexp@quack3> (raw)
I've got this complaint from coverity:
----- Forwarded message from scan-admin@coverity.com -----
________________________________________________________________________________________________________
*** CID 1600337: (UNINIT)
/fs/attr.c: 311 in setattr_copy_mgtime()
305 else if (ia_valid & ATTR_ATIME)
306 inode_set_atime_to_ts(inode, now);
307
308 if (ia_valid & ATTR_MTIME_SET)
309 inode_set_mtime_to_ts(inode, attr->ia_mtime);
310 else if (ia_valid & ATTR_MTIME)
>>> CID 1600337: (UNINIT)
>>> Using uninitialized value "now" when calling "inode_set_mtime_to_ts".
311 inode_set_mtime_to_ts(inode, now);
312 }
313
314 /**
315 * setattr_copy - copy simple metadata updates into the generic inode
316 * @idmap: idmap of the mount the inode was found from
/fs/attr.c: 306 in setattr_copy_mgtime()
300 WARN_ON_ONCE(ia_valid & ATTR_MTIME);
301 }
302
303 if (ia_valid & ATTR_ATIME_SET)
304 inode_set_atime_to_ts(inode, attr->ia_atime);
305 else if (ia_valid & ATTR_ATIME)
>>> CID 1600337: (UNINIT)
>>> Using uninitialized value "now" when calling "inode_set_atime_to_ts".
306 inode_set_atime_to_ts(inode, now);
307
308 if (ia_valid & ATTR_MTIME_SET)
309 inode_set_mtime_to_ts(inode, attr->ia_mtime);
310 else if (ia_valid & ATTR_MTIME)
311 inode_set_mtime_to_ts(inode, now);
Now we WARN if ATTR_MTIME is set without ATTR_CTIME but still it might be
good to place some sane value in 'now' so that we don't set the timestamp
to garbage and more importantly setting ATTR_ATIME without ATTR_CTIME looks
as a possible thing?
Honza
--
Jan Kara <jack@suse.com>
SUSE Labs, CR
reply other threads:[~2024-10-09 15:30 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=20241009153022.5uyp6aku2kcfeexp@quack3 \
--to=jack@suse.cz \
--cc=brauner@kernel.org \
--cc=jlayton@kernel.org \
--cc=linux-fsdevel@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).