[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAC80aeigBG9vdbG-RY9wV7vezd6uw+XcdnFQ81A7Bkq3pdSWxw@mail.gmail.com>
Date: Wed, 17 Dec 2014 16:03:45 -0800
From: 👾 Wade <wadetregaskis@...gle.com>
To: Andreas Dilger <adilger@...ger.ca>
Cc: linux-ext4@...r.kernel.org
Subject: Re: Patch adding e2p_feature_to_string
> What's wrong with a pointer to a static string? Since the strings are
>
> static, none of the callers can change them. Since they are just pointers,
> they can be shared by any number of callers.
The existing code doesn't always return a static string - sometimes it
sprintfs one up...
> > +const char *e2p_feature2string(int compat, unsigned int mask)
> > +{
> > + static char buf[20];
> > + e2p_feature_to_string(compat, mask, buf, sizeof(buf) / sizeof(buf[0]));
>
> This is copying into a single shared buffer for all callers, which is
> not thread safe.
... exactly.
--
To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists