sparc64: Add Null-checking for mdesc_grab() in ds_probe()
PATCH 1/1 sparc64: Add Null-checking for mdesc_grab() in ds_probe()
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 <[email protected]>
--- arch/sparc/kernel/ds.c | 4 ++++ 1 file changed, 4 insertions(+)
arch/sparc/kernel/ds.c +4 -0
@@ -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;
Signature · 1 line
2.25.1