From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from out-174.mta1.migadu.com (out-174.mta1.migadu.com [95.215.58.174]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 465D438DF9 for ; Mon, 20 Apr 2026 01:09:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=95.215.58.174 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1776647393; cv=none; b=FJZ2B4DxA5L5UbRw6ZxNO6fzqjMABNHhPC10VGpDY0uBJAAt/phx+TQy6Xsuu4gsEYXc+qcYYVao5As3DCLh0HFTuNMl205cNZzk11t4YeqB9jFCtYColOsGLwDhWAZv31vL1SXcNCYgfb1Fzr/obGfpsVP6NBXTElpcCq7dn7o= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1776647393; c=relaxed/simple; bh=0OFhldqB6M4TsEf+NALZiJmWva8Xum/Lp47xNKyMamg=; h=MIME-Version:Date:Content-Type:From:Message-ID:Subject:To:Cc: In-Reply-To:References; b=JOPwD5vFWPR2VRw/LgKRhLBUUN7NutjTXXRMNsfUxHWyMfk2le9lh83kF045q2r8OgSn6vHDPn/OYKgP/69oXV4Z/4Wxay5kBy64Hmlh8W1SdbNPOa2JgKChO90PQNolk8A7YwmVARJLbwdi7QoyVVBDbAbolUDZDLembJRcNro= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev; spf=pass smtp.mailfrom=linux.dev; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b=Osnvv86a; arc=none smtp.client-ip=95.215.58.174 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.dev Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="Osnvv86a" Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1776647386; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=2YIChuj/xzLlQ/FzRUUTT1CABmjJDTZrcYGppYIN00M=; b=Osnvv86aI+Uh5BzJC5hmnoa8du5qawpLCVeUsnt1WOt4bC/rdDmh/iwaqs/Jh9o7d7Z/un AdlWG14Z8dClDR22HHqXniw02WVikVTXKlGRUH3G0mW9gePH+U/j8GK8QA3unPUAVeEnWq BjtktXDH5d1lxOMdDHQAZdzz9WfOzAA= Date: Mon, 20 Apr 2026 01:09:39 +0000 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. From: sunliming@linux.dev Message-ID: TLS-Required: No Subject: Re: [PATCH] drm/nouveau/gsp: Fix possible NULL pointer dereference warning in r535_dmac_alloc To: "Danilo Krummrich" Cc: lyude@redhat.com, maarten.lankhorst@linux.intel.com, mripard@kernel.org, tzimmermann@suse.de, airlied@gmail.com, simona@ffwll.ch, dri-devel@lists.freedesktop.org, nouveau@lists.freedesktop.org, linux-kernel@vger.kernel.org, "sunliming" In-Reply-To: References: <20260418071412.86022-1-sunliming@linux.dev> X-Migadu-Flow: FLOW_OUT 2026=E5=B9=B44=E6=9C=8818=E6=97=A5 20:12, "Danilo Krummrich" =E5=86=99=E5=88=B0: >=20 >=20On Sat Apr 18, 2026 at 9:14 AM CEST, sunliming wrote: >=20 >=20>=20 >=20> From: sunliming > >=20 >=20> Fix below smatch warnings: > > drivers/gpu/drm/nouveau/nvkm/subdev/gsp/rm/r535/disp.c:178 r535_dmac= _alloc() > > warn: 'args' can also be NULL > >=20 >=20Please write a commit description that explains also the underlying p= roblem; see > more below. >=20 >=20>=20 >=20> Signed-off-by: sunliming > > --- > > drivers/gpu/drm/nouveau/nvkm/subdev/gsp/rm/r535/disp.c | 2 ++ > > 1 file changed, 2 insertions(+) > >=20 >=20> diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/gsp/rm/r535/disp.= c b/drivers/gpu/drm/nouveau/nvkm/subdev/gsp/rm/r535/disp.c > > index 6e63df816d85..6dec2623d0be 100644 > > --- a/drivers/gpu/drm/nouveau/nvkm/subdev/gsp/rm/r535/disp.c > > +++ b/drivers/gpu/drm/nouveau/nvkm/subdev/gsp/rm/r535/disp.c > > @@ -172,6 +172,8 @@ r535_dmac_alloc(struct nvkm_disp *disp, u32 ocla= ss, int inst, u32 put_offset, > >=20=20 >=20> args =3D nvkm_gsp_rm_alloc_get(&disp->rm.object, (oclass << 16) | = inst, oclass, > > sizeof(*args), dmac); > > + if (!args) > > + return -ENOMEM; > >=20 >=20Are we sure that this can ever return NULL in the first place? I know= that > nvkm_gsp_rm_alloc_get() internally checks for IS_ERR_OR_NULL(), but I c= ouldn't > find anything within the callchain that would actually return NULL. >=20 >=20That said, I think IS_ERR_OR_NULL() checks are misleading. >=20 I=20also believe that the nvkm_gsp_rm_alloc_get function will not return = NULL. My patch=20 was=20merely intended to suppress a compiler warning and to guard against= possible future=20 changes=20in the implementation of nvkm_gsp_rm_alloc_get. Of course, the = patch may be=20 unnecessary,=20and I will defer to the maintainers' review conclusion. Thanks. > >=20 >=20> if (IS_ERR(args)) > > return PTR_ERR(args); > >=20=20 >=20> --=20 >=20> 2.25.1 > > >