[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <1260433202.7913.24.camel@falcon.domain.org>
Date: Thu, 10 Dec 2009 16:20:02 +0800
From: Wu Zhangjin <wuzhangjin@...il.com>
To: Greg Kroah-Hartman <gregkh@...e.de>
Cc: linux-kernel <linux-kernel@...r.kernel.org>
Subject: Potential NULL pointer reference in platform_device_register()
Hi, Greg KH,
Should we filter the potential NULL pointer in
platform_device_register() like this?
drivers/base/platform.c:
int platform_device_register(struct platform_device *pdev)
{
+ if (!pdev)
+ return -EINVAL;
device_initialize(&pdev->dev);
return platform_device_add(pdev);
}
EXPORT_SYMBOL_GPL(platform_device_register);
Of course, the developers need to ensure they not register a NULL
platform device, but sometimes they will not know that.
Perhaps the above method will hide the real bug, so, what about BUG_ON(!
pdev).
Best Regards,
Wu Zhangjin
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists