[Nouveau] [PATCH v4 34/37] mc: fix NULL pointer access in libnouveau

Martin Peres martin.peres at free.fr
Wed Apr 20 22:21:30 UTC 2016


On 18/04/16 22:14, Karol Herbst wrote:
> Signed-off-by: Karol Herbst <nouveau at karolherbst.de>
> ---
>   drm/nouveau/nvkm/subdev/mc/base.c | 7 ++++++-
>   1 file changed, 6 insertions(+), 1 deletion(-)
>
> diff --git a/drm/nouveau/nvkm/subdev/mc/base.c b/drm/nouveau/nvkm/subdev/mc/base.c
> index aa394af..88bc1cc 100644
> --- a/drm/nouveau/nvkm/subdev/mc/base.c
> +++ b/drm/nouveau/nvkm/subdev/mc/base.c
> @@ -90,10 +90,15 @@ nvkm_mc_intr(struct nvkm_mc *mc, bool *handled)
>   void
>   nvkm_mc_reset(struct nvkm_mc *mc, enum nvkm_devidx devidx)
>   {
> -	struct nvkm_device *device = mc->subdev.device;
> +	struct nvkm_device *device;
>   	const struct nvkm_mc_map *map;
>   	u64 pmc_enable;
>   
> +	if (!mc)
> +		return;
Not sure what is the policy of Ben on this, fixing the caller or the 
callee. His call!
> +
> +	device = mc->subdev.device;
> +
>   	if (!(pmc_enable = nvkm_top_reset(device->top, devidx))) {
>   		for (map = mc->func->reset; map && map->stat; map++) {
>   			if (map->unit == devidx) {



More information about the Nouveau mailing list