Skip to contentSkip to conversation

Wrong error handling in nfs4acl

PATCH In review Eric Sesterhenn 3 participants 4 messages Mar 7, 2006 NFS server

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Wrong error handling in nfs4acl

hi,

this fixes coverity id #3. Coverity detected dead code, since the == -1 comparison only returns 0 or 1 to error. Therefore the if ( error < 0 ) statement was always false. Seems that this was an if( error = nfs4... ) statement some time ago, which got broken during cleanup.
Just compile tested.

fs/nfsd/nfs4acl.c renamed from fs/nfsd/nfs4acl.c.orig +1 -1
@@ -790,7 +790,7 @@ nfs4_acl_split(struct nfs4_acl *acl, str
 			continue;
 
 		error = nfs4_acl_add_ace(dacl, ace->type, ace->flag,
-				ace->access_mask, ace->whotype, ace->who) == -1;
+				ace->access_mask, ace->whotype, ace->who);
 		if (error < 0)
 			goto out;
 
#1 lore raw
Quoted 10 lines · Eric Sesterhenn

hi,

this fixes coverity id #3. Coverity detected dead code, since the == -1 comparison only returns 0 or 1 to error. Therefore the if ( error < 0 ) statement was always false. Seems that this was an if( error = nfs4... ) statement some time ago, which got broken during cleanup.
Just compile tested.

Thanks! Applied to my tree.--b.

#2 lore raw
In reply to Eric Sesterhenn
Quoted 16 lines · On Tuesday March 7, [email protected] wrote:

hi,

this fixes coverity id #3. Coverity detected dead code, since the == -1 comparison only returns 0 or 1 to error. Therefore the if ( error < 0 ) statement was always false. Seems that this was an if( error = nfs4... ) statement some time ago, which got broken during cleanup.
Just compile tested.

fs/nfsd/nfs4acl.c nfs4_acl_split(struct nfs4_acl *acl, str · line 796

Quoted 8 lines
fs/nfsd/nfs4acl.c renamed from fs/nfsd/nfs4acl.c.orig +1 -1
@@ -790,7 +790,7 @@ nfs4_acl_split(struct nfs4_acl *acl, str
 			continue;
 
 		error = nfs4_acl_add_ace(dacl, ace->type, ace->flag,
-				ace->access_mask, ace->whotype, ace->who) == -1;
+				ace->access_mask, ace->whotype, ace->who);
 		if (error < 0)
 			goto out;
 

Yeh, thanks....
I think we want to change nfs4_acl_add_ace to return -ENOMEM rather than -1 too.

Bruce?

#3 lore raw
Quoted 2 lines · Neil Brown

I think we want to change nfs4_acl_add_ace to return -ENOMEM rather than -1 too.

Whoops, yes, a search for "-1" in that file produces a number of dubious returns. I'll make a patch.

--b.