linux-nfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: Trond.Myklebust@netapp.com
Cc: linux-nfs@vger.kernel.org
Subject: re: NFSv4: Fix a regression against the FreeBSD server
Date: Tue, 23 Jul 2013 19:06:27 +0300	[thread overview]
Message-ID: <20130723160627.GA2370@elgon.mountain> (raw)

Hello Trond Myklebust,

This is a semi-automatic email about new static checker warnings.

The patch b4a2cf76ab7c: "NFSv4: Fix a regression against the FreeBSD 
server" from Jul 17, 2013, leads to the following Smatch complaint:

fs/nfs/nfs4xdr.c:1103 encode_attrs()
	 error: we previously assumed 'label' could be null (see line 1059)

fs/nfs/nfs4xdr.c
  1058		}
  1059		if (label) {
                    ^^^^^
New check.

  1060			len += 4 + 4 + 4 + (XDR_QUADLEN(label->len) << 2);
  1061			bmval[2] |= FATTR4_WORD2_SECURITY_LABEL;
  1062		}
  1063	
  1064		if (bmval[2] != 0)
  1065			bmval_len = 3;
  1066		else if (bmval[1] != 0)
  1067			bmval_len = 2;
  1068		else
  1069			bmval_len = 1;
  1070	

[snip]

  1094		if (bmval[1] & FATTR4_WORD1_TIME_MODIFY_SET) {
  1095			if (iap->ia_valid & ATTR_MTIME_SET) {
  1096				*p++ = cpu_to_be32(NFS4_SET_TO_CLIENT_TIME);
  1097				p = xdr_encode_hyper(p, (s64)iap->ia_mtime.tv_sec);
  1098				*p++ = cpu_to_be32(iap->ia_mtime.tv_nsec);
  1099			} else
  1100				*p++ = cpu_to_be32(NFS4_SET_TO_SERVER_TIME);
  1101		}
  1102		if (bmval[2] & FATTR4_WORD2_SECURITY_LABEL) {
  1103			*p++ = cpu_to_be32(label->lfs);
                                           ^^^^^^^^^^
Old dereference.

  1104			*p++ = cpu_to_be32(label->pi);
  1105			*p++ = cpu_to_be32(label->len);

regards,
dan carpenter

             reply	other threads:[~2013-07-23 16:06 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-07-23 16:06 Dan Carpenter [this message]
2013-07-23 16:12 ` NFSv4: Fix a regression against the FreeBSD server Myklebust, Trond
2013-07-23 18:32   ` 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=20130723160627.GA2370@elgon.mountain \
    --to=dan.carpenter@oracle.com \
    --cc=Trond.Myklebust@netapp.com \
    --cc=linux-nfs@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).