Re: Patch adding e2p_feature_to_string

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

 



> 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@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Reiser Filesystem Development]     [Ceph FS]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Linux FS]     [Yosemite National Park]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Device Mapper]     [Linux Media]

  Powered by Linux