As other functions in this module do, edev should be checked to
ensure that it is not NULL.
The fix inserts such as check to avoid potential NULL pointer
dereference.

Signed-off-by: Kangjie Lu <k...@umn.edu>
---
 drivers/firmware/edd.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/firmware/edd.c b/drivers/firmware/edd.c
index 1b82c89a49df..7ebfaca53721 100644
--- a/drivers/firmware/edd.c
+++ b/drivers/firmware/edd.c
@@ -279,6 +279,8 @@ static ssize_t
 edd_show_mbr_signature(struct edd_device *edev, char *buf)
 {
        char *p = buf;
+       if (!edev)
+               return -EINVAL;
        p += scnprintf(p, left, "0x%08x\n", edev->mbr_signature);
        return (p - buf);
 }
-- 
2.17.1

Reply via email to