Re: NFSv4: Fix a regression against the FreeBSD server

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, 2013-07-23 at 19:06 +0300, Dan Carpenter wrote:
> 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);

Hi Dan,

Maybe I need another coffee, but right now I don't see what the problem
is. We only set FATTR4_WORD2_SECURITY_LABEL if the check that label !=
NULL passes. What am I missing?

-- 
Trond Myklebust
Linux NFS client maintainer

NetApp
Trond.Myklebust@xxxxxxxxxx
www.netapp.com
��.n��������+%������w��{.n�����{��w���jg��������ݢj����G�������j:+v���w�m������w�������h�����٥





[Index of Archives]     [Linux Filesystem Development]     [Linux USB Development]     [Linux Media Development]     [Video for Linux]     [Linux NILFS]     [Linux Audio Users]     [Yosemite Info]     [Linux SCSI]

  Powered by Linux