Skip to contentSkip to conversation

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

DISCUSSION Himanshu Chauhan 1 participant 1 message Aug 10, 2008 Kernel janitors

lore
Share & tools
lore
#0 lore raw

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 [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html