Messages in this thread Patch in this message | | | Date | Tue, 2 Nov 2004 10:03:34 -0600 | From | Maneesh Soni <> | Subject | Re: sysfs backing store error path confusion |
| |
On Tue, Nov 02, 2004 at 02:46:58AM -0600, Milton Miller wrote: > sysfs_new_dirent returns ERR_PTR(-ENOMEM) if kmalloc fails but the callers > were expecting NULL. > > Compile & link tested. (Yes, changing the callee would be a smaller change). >
Thanks for spotting this. But as you said, I will prefer to change the callee. How about this patch?
Andrew, Greg, please include this if found ok.
Thanks Maneesh
o sysfs_new_dirent to retrun NULL if kmalloc fails. Thanks to Milton Miller for spotting this.
Signed-off-by: <maneesh@in.ibm.com> ---
linux-2.6.10-rc1-bk12-maneesh/fs/sysfs/dir.c | 2 +- 1 files changed, 1 insertion(+), 1 deletion(-)
diff -puN fs/sysfs/dir.c~fix-sysfs_new_dirent-return fs/sysfs/dir.c --- linux-2.6.10-rc1-bk12/fs/sysfs/dir.c~fix-sysfs_new_dirent-return 2004-11-02 08:38:57.000000000 -0600 +++ linux-2.6.10-rc1-bk12-maneesh/fs/sysfs/dir.c 2004-11-02 09:17:18.000000000 -0600 @@ -38,7 +38,7 @@ static struct sysfs_dirent * sysfs_new_d sd = kmalloc(sizeof(*sd), GFP_KERNEL); if (!sd) - return -ENOMEM; + return NULL; memset(sd, 0, sizeof(*sd)); atomic_set(&sd->s_count, 1); _ -- Maneesh Soni Linux Technology Center, IBM Austin email: maneesh@in.ibm.com Phone: 1-512-838-1896 Fax: T/L : 6781896 - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
| |