Re: [PATCH v3 1/2] init/do_mounts.c: ignore final \n in name_to_dev_t

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

 



Quoting Andrew Morton (2014-01-28 12:54:42)
> The problem is that kernel/power/hibernate.c:resume_store() is handed a
> newline-terminated string, yes?  And if it blindly hands that string
> over to name_to_dev_t(), name_to_dev_t() fails because the string is
> wrong.
> 
> This is an oddity of the sysfs->kernel interface and altering
> name_to_dev_t doesn't really seem appropriate for this problem - it
> would be better to fix the caller to pass in the correct string.
> 
> Something like...
> 
> /*
>  * Clean up a string which may have leading and/or trailing whitespace (as
>  * defined by isspace()) by trimming off that whitespace.  Returns an address
>  * which the caller must kfree(), or NULL on error.
>  */
> char *strim_copy(const char *s, gfp_t gfp)
> {
>         char *ret = kstrdup(skip_spaces(s), gfp);
> 
>         if (ret)
>                 strim(ret);
>         return ret;
> }
> EXPORT_SYMBOL(strim_copy);

Hi Andrew,

Thanks, this is similar, but tidier than my original patch.  I'll
fix up and repost the patch with a fix like what you're proposing.

Thanks!

Sebastian

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@xxxxxxxxxxxxxxxxxxx
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel




[Index of Archives]     [Linux Kernel]     [Linux ARM (vger)]     [Linux ARM MSM]     [Linux Omap]     [CentOS ARM]     [Linux Arm]     [Linux Tegra]     [Fedora ARM]     [Linux for Samsung SOC]     [eCos]     [Linux Fastboot]     [Gcc Help]     [Git]     [DCCP]     [IETF Announce]     [Security]     [Linux MIPS]     [Yosemite Campsites]     [Photos]