Re: [PATCH] Gpu: drm: tegra - Fix possible NULL derefrence.
On Mon, Jan 30, 2017 at 10:23:45AM +0530, Shailendra Verma wrote: > of_match_device could return NULL, and so can cause a NULL > pointer dereference later. > > Signed-off-by: Shailendra Verma> --- > drivers/gpu/drm/tegra/sor.c |4 > 1 file changed, 4 insertions(+) No, this will never happen on Tegra. If you reach the ->probe() function this pointer is guaranteed to be non-NULL. Thierry signature.asc Description: PGP signature
Re: [PATCH] Gpu: drm: tegra - Fix possible NULL derefrence.
On Mon, Jan 30, 2017 at 10:23:45AM +0530, Shailendra Verma wrote: > of_match_device could return NULL, and so can cause a NULL > pointer dereference later. > > Signed-off-by: Shailendra Verma > --- > drivers/gpu/drm/tegra/sor.c |4 > 1 file changed, 4 insertions(+) No, this will never happen on Tegra. If you reach the ->probe() function this pointer is guaranteed to be non-NULL. Thierry signature.asc Description: PGP signature
[PATCH] Gpu: drm: tegra - Fix possible NULL derefrence.
of_match_device could return NULL, and so can cause a NULL pointer dereference later. Signed-off-by: Shailendra Verma--- drivers/gpu/drm/tegra/sor.c |4 1 file changed, 4 insertions(+) diff --git a/drivers/gpu/drm/tegra/sor.c b/drivers/gpu/drm/tegra/sor.c index 74d0540..34f032f 100644 --- a/drivers/gpu/drm/tegra/sor.c +++ b/drivers/gpu/drm/tegra/sor.c @@ -2540,6 +2540,10 @@ static int tegra_sor_probe(struct platform_device *pdev) int err; match = of_match_device(tegra_sor_of_match, >dev); + if (!match) { + dev_err(>dev, "Error: No device match found\n"); + return -ENODEV; + } sor = devm_kzalloc(>dev, sizeof(*sor), GFP_KERNEL); if (!sor) -- 1.7.9.5
[PATCH] Gpu: drm: tegra - Fix possible NULL derefrence.
of_match_device could return NULL, and so can cause a NULL pointer dereference later. Signed-off-by: Shailendra Verma --- drivers/gpu/drm/tegra/sor.c |4 1 file changed, 4 insertions(+) diff --git a/drivers/gpu/drm/tegra/sor.c b/drivers/gpu/drm/tegra/sor.c index 74d0540..34f032f 100644 --- a/drivers/gpu/drm/tegra/sor.c +++ b/drivers/gpu/drm/tegra/sor.c @@ -2540,6 +2540,10 @@ static int tegra_sor_probe(struct platform_device *pdev) int err; match = of_match_device(tegra_sor_of_match, >dev); + if (!match) { + dev_err(>dev, "Error: No device match found\n"); + return -ENODEV; + } sor = devm_kzalloc(>dev, sizeof(*sor), GFP_KERNEL); if (!sor) -- 1.7.9.5