linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* New Defects reported by Coverity Scan for linux-next weekly scan (fwd)
@ 2024-10-09 15:30 Jan Kara
  0 siblings, 0 replies; only message in thread
From: Jan Kara @ 2024-10-09 15:30 UTC (permalink / raw)
  To: Jeff Layton; +Cc: Christian Brauner, linux-fsdevel

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

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

only message in thread, other threads:[~2024-10-09 15:30 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-10-09 15:30 New Defects reported by Coverity Scan for linux-next weekly scan (fwd) Jan Kara

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).