[linux-cifs-client] Re: [PATCH] cifs: fix pointer initialization and checks in cifs_follow_symlink (try #3)

Jeff Layton jlayton at redhat.com
Tue May 19 14:00:37 GMT 2009


On Tue, 19 May 2009 09:42:02 -0400
Jeff Moyer <jmoyer at redhat.com> wrote:

> Well, you've sacrificed your logging for this.  See below.
> 
> > index ea9d11e..737a386 100644
> > --- a/fs/cifs/link.c
> > +++ b/fs/cifs/link.c
> > @@ -107,48 +107,48 @@ void *
> >  cifs_follow_link(struct dentry *direntry, struct nameidata *nd)
> >  {
> >  	struct inode *inode = direntry->d_inode;
> > -	int rc = -EACCES;
> > +	int rc = -ENOMEM;
> >  	int xid;
> >  	char *full_path = NULL;
> > -	char *target_path = ERR_PTR(-ENOMEM);
> > -	struct cifs_sb_info *cifs_sb;
> > -	struct cifsTconInfo *pTcon;
> > +	char *target_path = NULL;
> > +	struct cifs_sb_info *cifs_sb = CIFS_SB(inode->i_sb);
> > +	struct cifsTconInfo *tcon = cifs_sb->tcon;
> >  
> >  	xid = GetXid();
> >  
> > -	full_path = build_path_from_dentry(direntry);
> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
> > -
> > -	if (!full_path)
> > -		goto out;
> > -
> >  	cFYI(1, ("Full path: %s inode = 0x%p", full_path, inode));
> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
> 
> Aside from that, the patch looks good.
> 
> Cheers,
> Jeff

Good catch.

There's still logging done on the function entry and exit (via the
GetXid/FreeXid side effects), so it's not a complete loss. How's this
instead? The only difference is that I moved the cFYI statement down.

-- 
Jeff Layton <jlayton at redhat.com>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-cifs-fix-pointer-initialization-and-checks-in-cifs_.patch
Type: text/x-patch
Size: 4231 bytes
Desc: not available
Url : http://lists.samba.org/archive/linux-cifs-client/attachments/20090519/99915a25/0001-cifs-fix-pointer-initialization-and-checks-in-cifs_.bin


More information about the linux-cifs-client mailing list