memcpy on const pointer, warning in smbfs/cache.c

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

 



Dear all,

I pulled out latest source from Linus's git tree. During compilation of smbfs/cache.c in line 148 I got a warning stating

warning: passing argument 1 of ‘__constant_memcpy’ discards qualifiers from pointer target type

This was in function smb_fill_cache where memcpy is being used as following:

memcpy((char *) newdent->d_name.name, qname->name,
		       newdent->d_name.len);

d_name is of type struct qstr and in qstr name is defined as const unsigned char *.

struct qstr {
	unsigned int hash;
	unsigned int len;
	const unsigned char *name;
};

So this type cast is wrong.

Is it ok to fix this by defineing name as unsigned char * rather than as const unsigned char *?

Regards
--Himanshu

--
To unsubscribe from this list: send the line "unsubscribe kernel-janitors" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Kernel Development]     [Kernel Announce]     [Kernel Newbies]     [Linux Networking Development]     [Share Photos]     [IDE]     [Security]     [Git]     [Netfilter]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Device Mapper]

  Powered by Linux