[PATCH] sparc64: Add Null-checking for mdesc_grab() in ds_probe()

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

 



In ds_probe(), the mdesc_grab() may return NULL pointer,
we should add the check to avoid NPD bug.

Fixes: a88b5ba8bd8a ("sparc,sparc64: unify kernel/")
Signed-off-by: Liang He <windhl@xxxxxxx>
---
 arch/sparc/kernel/ds.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/arch/sparc/kernel/ds.c b/arch/sparc/kernel/ds.c
index 4a5bdb0df779..e14a8fb466b8 100644
--- a/arch/sparc/kernel/ds.c
+++ b/arch/sparc/kernel/ds.c
@@ -1178,6 +1178,10 @@ static int ds_probe(struct vio_dev *vdev, const struct vio_device_id *id)
 		goto out_err;
 
 	hp = mdesc_grab();
+	if (!hp) {
+		err = -ENODEV;
+		goto out_err;
+	}
 	val = mdesc_get_property(hp, vdev->mp, "id", NULL);
 	if (val)
 		dp->id = *val;
-- 
2.25.1




[Index of Archives]     [Kernel Development]     [DCCP]     [Linux ARM Development]     [Linux]     [Photo]     [Yosemite Help]     [Linux ARM Kernel]     [Linux SCSI]     [Linux x86_64]     [Linux Hams]

  Powered by Linux