Skip to contentSkip to conversation

qstr abuse in git-cifs

DISCUSSION Andrew Morton 1 participant 1 message Nov 6, 2007 VFS

lore
Share & tools
lore
#0 lore raw

static int cifs_ci_compare(struct dentry *dentry, struct qstr *a,
struct qstr *b)

{
        struct nls_table *codepage = CIFS_SB(dentry->d_inode->i_sb)->local_nls;

        if ((a->len == b->len) &&
            (nls_strnicmp(codepage, a->name, b->name, a->len) == 0)) {
                /*
                 * To preserve case, don't let an existing negative dentry's
                 * case take precedence.  If a is not a negative dentry, this
                 * should have no side effects
                 */
                memcpy(a->name, b->name, a->len);
                return 0;
        }
        return 1;
}

produces

fs/cifs/dir.c: In function 'cifs_ci_compare':
fs/cifs/dir.c:596: warning: passing argument 1 of '__constant_memcpy' discards qualifiers from pointer target type fs/cifs/dir.c:596: warning: passing argument 1 of '__memcpy' discards qualifiers from pointer target type

I suspect that bad things are happening in there.

It's strange for a "comparison" function to go and alter one of the things which it's comparing, too.