[linux-cifs-client] [PATCH] [CIFS] cast destination qstr->name in memcpy called from cifs_ci_compare

Christoph Hellwig hch at infradead.org
Tue Apr 29 19:55:21 GMT 2008


On Tue, Apr 29, 2008 at 03:51:02PM -0400, Jeff Layton wrote:
> One of the ACL handling patches removed an explict cast in a memcpy
> call in cifs_ci_compare. This is causing the following compile time
> warning:
> 
>     fs/cifs/dir.c: In function ???cifs_ci_compare???:
>     fs/cifs/dir.c:593: warning: passing argument 1 of ???memcpy???
>     discards qualifiers from pointer target type
> 
> I don't see any reason for the removal, and putting it back silences
> this warning.

The warning there is because this is wrong.  CIFS should be doing
something similar to fs/ntfs/namei.c:ntfs_lookup() for handling of
CI filename.  We'll soon get a routine lifted from that one in generic
code as part of the XFS CI support for Samba that should be used by
cifs aswell.

> ---
> 
>  fs/cifs/dir.c |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
> 
> diff --git a/fs/cifs/dir.c b/fs/cifs/dir.c
> index 6ed7759..31ae007 100644
> --- a/fs/cifs/dir.c
> +++ b/fs/cifs/dir.c
> @@ -580,7 +580,7 @@ static int cifs_ci_compare(struct dentry *dentry, struct qstr *a,
>  		 * case take precedence.  If a is not a negative dentry, this
>  		 * should have no side effects
>  		 */
> -		memcpy(a->name, b->name, a->len);
> +		memcpy((unsigned char *) a->name, b->name, a->len);
>  		return 0;
>  	}
>  	return 1;
> 
> _______________________________________________
> linux-cifs-client mailing list
> linux-cifs-client at lists.samba.org
> https://lists.samba.org/mailman/listinfo/linux-cifs-client
---end quoted text---


More information about the linux-cifs-client mailing list