Bug 201284 - sys/fs/tmpfs/tmpfs_subr.c: 2 * bad if statements ?
Summary: sys/fs/tmpfs/tmpfs_subr.c: 2 * bad if statements ?
Status: Closed FIXED
Alias: None
Product: Base System
Classification: Unclassified
Component: misc (show other bugs)
Version: 10.3-BETA2
Hardware: Any Any
: --- Affects Many People
Assignee: Christian Brueffer
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-07-02 16:09 UTC by David Binderman
Modified: 2018-03-09 18:01 UTC (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description David Binderman 2015-07-02 16:09:27 UTC
1.

sys/fs/tmpfs/tmpfs_subr.c:1691]: (style) Same expression on both sides of '&&'.

  if (vap->va_birthtime.tv_nsec != VNOVAL &&
        vap->va_birthtime.tv_nsec != VNOVAL)

Looking at nearby code, maybe

  if (vap->va_birthtime.tv_sec != VNOVAL &&
        vap->va_birthtime.tv_nsec != VNOVAL)

2.

sys/fs/tmpfs/tmpfs_subr.c:1697]: (style) Same expression on both sides of '&&'.

Same thing a few lines further down.
Comment 1 commit-hook freebsd_committer freebsd_triage 2015-07-26 08:34:28 UTC
A commit references this bug:

Author: brueffer
Date: Sun Jul 26 08:33:47 UTC 2015
New revision: 285885
URL: https://svnweb.freebsd.org/changeset/base/285885

Log:
  In tmpfs_chtimes(), remove checks on the nanosecond level when
  determining whether a node changed.

  Other filesystems, e.g., UFS, only check on seconds, when determining
  whether something changed.

  This also corrects the birthtime case, where we checked tv_nsec
  twice, instead of tv_sec and tv_nsec (PR).

  PR:			201284
  Submitted by:		David Binderman
  Patch suggested by:	kib
  Reviewed by:		kib
  MFC after:		2 weeks
  Committed from:		Essen FreeBSD Hackathon

Changes:
  head/sys/fs/tmpfs/tmpfs_subr.c
Comment 2 Christian Brueffer freebsd_committer freebsd_triage 2015-07-26 08:35:48 UTC
Fixed in HEAD, I'll merge this in a little bit.  Thanks!
Comment 3 Pedro F. Giffuni freebsd_committer freebsd_triage 2016-04-09 02:38:20 UTC
(In reply to Christian Brueffer from comment #2)

FWIW, playing with coccinelle, I noticed this issue is still on 10-stable.
Gentle reminder to MFC ;).
Comment 4 commit-hook freebsd_committer freebsd_triage 2018-03-09 18:00:23 UTC
A commit references this bug:

Author: emaste
Date: Fri Mar  9 17:59:22 UTC 2018
New revision: 330700
URL: https://svnweb.freebsd.org/changeset/base/330700

Log:
  MFC r285885 by brueffer:

  In tmpfs_chtimes(), remove checks on the nanosecond level when
  determining whether a node changed.

  Other filesystems, e.g., UFS, only check on seconds, when determining
  whether something changed.

  This also corrects the birthtime case, where we checked tv_nsec
  twice, instead of tv_sec and tv_nsec (PR).

  PR:		201284

Changes:
_U  stable/10/
  stable/10/sys/fs/tmpfs/tmpfs_subr.c