Received: by 2002:a05:6500:1b8f:b0:1fa:5c73:8e2d with SMTP id df15csp624324lqb; Wed, 29 May 2024 06:14:36 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUsHREMrCJHLA+8H3P5/2usJkvoC4fRKgz1/05FOuhAUqpKzDwNLCW5extIk77Bzf/GpyHTFlnElpjgQRhsV+RPXy9djtxLY/qxCcscQA== X-Google-Smtp-Source: AGHT+IHEebrZWJhpN1FzWguQ0YlUnc+P4zMG2L1FG6sFtVDvmxCdEolNNYpUItAtv1Eym/wGNbii X-Received: by 2002:a05:6870:f719:b0:250:3c25:ca61 with SMTP id 586e51a60fabf-2503c25cb3dmr2606751fac.6.1716988476173; Wed, 29 May 2024 06:14:36 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1716988476; cv=pass; d=google.com; s=arc-20160816; b=Nj7DRbmf6kivhp+sELRkw0NMT1HGiVNs66BzBgEHSf/Na83rurH3Oiyh3DYIZMjKoz PllLsE8lnDJ93rNMP2ZCyc+oyk6kNBWNvK9vXFhhcera57GpHkprPSnaFuIi8w7whrQy eeXFpzucm7fhS+zRrFhED+yCoY3heCR6b/paDSd5oXgU6k0Vp693jpeibT1PtOttR7mE tudcCEg2T6LY7ucNI8Z6PDoNPBkM3+kqmH71F4Dv0nhjttsk3O5atq7XaGszguWdWfgb L0ViuRTqUicxUf9ANAhKchTnRquAGFWfyAJYF3iDPY0NNdgcnacueBaMG2eCf1hSCIPw m6vw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:date:message-id:dkim-signature; bh=5SCwcaI1yB4vAhPMDaiNOgfeEBRhhXW8MbfTI9gKG+4=; fh=Jyy1NYkHf2kgmw4x1tW8D0hFYTp6zVAHPBff5XDLGGc=; b=clR/8lkWIdQiojz8m7vOj6ZSMy74IzT5slW1Vx8YBCFx1YpO2N3SMjZ+SU7VSNSGK4 d5KyXekgAdXCVnHRv3gQKSqv7W5XfcJdJeVHsAnDj/tH2ArWi9JPsEpR/r8xrMn6ICJl Cw+2cod4EIVkagauSo2p74xQeHp7w1LR50laqN4fyC5LGYAFqdwwKUnJDNU0kSgkL/SB DRtlGSCP4+W121VktQ1LOgECcdppbhbAn4vNadM91EUS3+wr700BK+BnbJ5HxMS3x+BF p/9QAGfp6To1zU/Nx4lV6/qoMgw8Or2+gptUR3zfbDhyWAKoU+giSE/BM17hk62+JVCQ V4pQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=cw6Jd7fH; arc=pass (i=1 spf=pass spfdomain=collabora.com dkim=pass dkdomain=collabora.com dmarc=pass fromdomain=collabora.com); spf=pass (google.com: domain of linux-kernel+bounces-194138-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-194138-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=collabora.com Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id af79cd13be357-794b367bb97si1097849485a.490.2024.05.29.06.14.35 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 29 May 2024 06:14:36 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-194138-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=cw6Jd7fH; arc=pass (i=1 spf=pass spfdomain=collabora.com dkim=pass dkdomain=collabora.com dmarc=pass fromdomain=collabora.com); spf=pass (google.com: domain of linux-kernel+bounces-194138-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-194138-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=collabora.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id DE6021C2397E for ; Wed, 29 May 2024 13:14:35 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 0EA3E10799; Wed, 29 May 2024 13:14:27 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=collabora.com header.i=@collabora.com header.b="cw6Jd7fH" Received: from madrid.collaboradmins.com (madrid.collaboradmins.com [46.235.227.194]) (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 9BEE2DDAD; Wed, 29 May 2024 13:14:24 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=46.235.227.194 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716988466; cv=none; b=sKV0wnsNrF4OtCID6mRj+mCzeyRucbRnLrc114s0gtUSDPeuu85vOV4GKGVE9b8uWs/S7ucpwS/0A6eMvaSLhccThMCmuAmVGuDNiYPfQsVuXrjcTXwLu/Emd9t6x4aueksVcFaEAO+onTHcEdCm4hqfvMvP/NSz/E+f7pFvZp8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716988466; c=relaxed/simple; bh=DHUO90PUPhlMJ3B+9LiJkV1K2D77bjBIutGq+bUUtz4=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=PAzSIsiACoyFAbgZfbWGYny9kJUQvWBwyuoSLzHNBrPVAS9eQb19b7uXq5Awa6EXRndcvlaZluO6XuqvyMIo9q/xdnM8Jv4bpBKjcBhkYsukPuKS0+7xB73+/W3Z8V6QcODziEQqEaOEDQNpMhLZ59a5hBPaWWC/oBo39XVRR64= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=collabora.com; spf=pass smtp.mailfrom=collabora.com; dkim=pass (2048-bit key) header.d=collabora.com header.i=@collabora.com header.b=cw6Jd7fH; arc=none smtp.client-ip=46.235.227.194 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=collabora.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=collabora.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1716988462; bh=DHUO90PUPhlMJ3B+9LiJkV1K2D77bjBIutGq+bUUtz4=; h=Date:Subject:To:Cc:References:From:In-Reply-To:From; b=cw6Jd7fHS8GjpN9WNQ9abAufl1Zgwyndm8aJDcc0mYCCJHPbcDPU78u+hCucvxDSY UuUcvR7Z/XnpiviS9esGpR2ppZhmT1GuURxOm0JxsV6CyfxnN0fTQ295HbpFApHVMn /fFWBIWezuhTpAzL6uR9/j78oaPfGzcUMyX7At1AOi1iHRKf7KOXz51SBxqO7FTt/5 Zx7qZ+LqRGbNhmzRXYcpSyOe3VHiyCQaHY6lm8KmpORNlYeD9eN1DRmabvaiZcnGKo 9Thv4w6N9xiKisfM1Zu5Ax/HlyWJmGr5VKohI2m+4Gn34obcVbqH9eu7BxcPMxD54e LrjCUgo6LK6HQ== Received: from [100.95.196.182] (cola.collaboradmins.com [195.201.22.229]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: andrzej.p) by madrid.collaboradmins.com (Postfix) with ESMTPSA id CE9033782087; Wed, 29 May 2024 13:14:21 +0000 (UTC) Message-ID: <8a007787-c648-4ae3-829f-7a0b17dd9a89@collabora.com> Date: Wed, 29 May 2024 15:14:21 +0200 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH 1/3] media: mediatek: vcodec: fix h264 multi statless decoder smatch warning To: =?UTF-8?B?WXVuZmVpIERvbmcgKOiRo+S6kemjnik=?= , "nhebert@chromium.org" , "benjamin.gaignard@collabora.com" , "nfraprado@collabora.com" , "angelogioacchino.delregno@collabora.com" , "nicolas.dufresne@collabora.com" , "hverkuil-cisco@xs4all.nl" Cc: "linux-kernel@vger.kernel.org" , "linux-mediatek@lists.infradead.org" , "frkoenig@chromium.org" , "stevecho@chromium.org" , "linux-media@vger.kernel.org" , "devicetree@vger.kernel.org" , "daniel@ffwll.ch" , Project_Global_Chrome_Upstream_Group , "hsinyi@chromium.org" , "linux-arm-kernel@lists.infradead.org" References: <20240229095611.6698-1-yunfei.dong@mediatek.com> <20240229095611.6698-2-yunfei.dong@mediatek.com> <4949bd54-8c32-4490-ab19-d38796d29ac1@collabora.com> <9ba79ccf849054974a937d1d605910cf4c8552d6.camel@mediatek.com> Content-Language: en-US From: Andrzej Pietrasiewicz In-Reply-To: <9ba79ccf849054974a937d1d605910cf4c8552d6.camel@mediatek.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Hi, W dniu 3.04.2024 o 05:45, Yunfei Dong (董云飞) pisze: > Hi AngeloGioacchino, > > Thanks for your reviewing. > On Tue, 2024-04-02 at 11:50 +0200, AngeloGioacchino Del Regno wrote: >> Il 29/02/24 10:56, Yunfei Dong ha scritto: >>> Fix smatch static checker warning for vdec_h264_req_multi_if.c. >>> Leading to kernel crash when fb is NULL. >>> >>> Fixes: 397edc703a10 ("media: mediatek: vcodec: add h264 decoder") >>> Signed-off-by: Yunfei Dong >>> --- >>> .../vcodec/decoder/vdec/vdec_h264_req_multi_if.c | 9 >>> +++++++-- >>> 1 file changed, 7 insertions(+), 2 deletions(-) >>> >>> diff --git >>> a/drivers/media/platform/mediatek/vcodec/decoder/vdec/vdec_h264_req >>> _multi_if.c >>> b/drivers/media/platform/mediatek/vcodec/decoder/vdec/vdec_h264_req >>> _multi_if.c >>> index 0e741e0dc8ba..ab8e708e0df1 100644 >>> --- >>> a/drivers/media/platform/mediatek/vcodec/decoder/vdec/vdec_h264_req >>> _multi_if.c >>> +++ >>> b/drivers/media/platform/mediatek/vcodec/decoder/vdec/vdec_h264_req >>> _multi_if.c >>> @@ -724,11 +724,16 @@ static int vdec_h264_slice_single_decode(void >>> *h_vdec, struct mtk_vcodec_mem *bs >>> return vpu_dec_reset(vpu); >>> >>> fb = inst->ctx->dev->vdec_pdata->get_cap_buffer(inst->ctx); >>> + if (!fb) { >>> + mtk_vdec_err(inst->ctx, "fb buffer is NULL"); >>> + return -EBUSY; >>> + } >>> + >>> src_buf_info = container_of(bs, struct mtk_video_dec_buf, >>> bs_buffer); >>> dst_buf_info = container_of(fb, struct mtk_video_dec_buf, >>> frame_buffer); >>> >>> - y_fb_dma = fb ? (u64)fb->base_y.dma_addr : 0; >>> - c_fb_dma = fb ? (u64)fb->base_c.dma_addr : 0; >> >> You're changing the behavior here, can you please explain why this >> change is valid >> into the commit description? >> > The driver already add the condition to check whether fb is NULL at the > front, no need these two lines again. > Maybe Angelo refers to the function never returning -EBUSY before? While at it, if fb is a kind of a buffer, why not -ENOMEM when get_cap_buffer() fails? Regards, Andrzej >> Thanks, >> Angelo >> > Best Regards, > Yunfei Dong >>> + y_fb_dma = (u64)fb->base_y.dma_addr; >>> + c_fb_dma = (u64)fb->base_c.dma_addr; >>> mtk_vdec_debug(inst->ctx, "[h264-dec] [%d] y_dma=%llx >>> c_dma=%llx", >>> inst->ctx->decoded_frame_cnt, y_fb_dma, >>> c_fb_dma); >>> >> >> >>