linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Re: qstr abuse in git-cifs
@ 2007-11-06 15:28 Steve French
  0 siblings, 0 replies; 2+ messages in thread
From: Steve French @ 2007-11-06 15:28 UTC (permalink / raw)
  To: Andrew Morton, linux-fsdevel

> I suspect that bad things are happening in there
I doubt that it is too bad since various filesystems (including JFS
and CIFS) have always written over qstr->name in these dentries in
order to better handle case insensitive compares.   Other than trying
to remove the compiler warning recently (mainline throws the same
warning), I didn't see what changed other than now displaying a
warning.   I agree that it looks strange, but I also don't see a
trivial way to change it.  Any ideas on how to prevent the case of an
existing negative dentry from taking precedence? Creating more
dentries for these duplicates would seem like a worse idea.

> 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

-- 
Thanks,

Steve

^ permalink raw reply	[flat|nested] 2+ messages in thread
* qstr abuse in git-cifs
@ 2007-11-06  7:28 Andrew Morton
  0 siblings, 0 replies; 2+ messages in thread
From: Andrew Morton @ 2007-11-06  7:28 UTC (permalink / raw)
  To: Steven French; +Cc: linux-fsdevel


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.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2007-11-06 15:28 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-11-06 15:28 qstr abuse in git-cifs Steve French
  -- strict thread matches above, loose matches on Subject: below --
2007-11-06  7:28 Andrew Morton

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).