Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp3078075rwb; Fri, 16 Dec 2022 09:46:44 -0800 (PST) X-Google-Smtp-Source: AA0mqf7rvATAwh/YGfK/Z+k27b+jdtbJmxYwH/1jagujgPV5wWqFx+WdHYGE0QmQny8TlVSu8zSE X-Received: by 2002:a17:90a:9742:b0:219:c2f2:f818 with SMTP id i2-20020a17090a974200b00219c2f2f818mr34551277pjw.42.1671212804103; Fri, 16 Dec 2022 09:46:44 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1671212804; cv=none; d=google.com; s=arc-20160816; b=S7240JBvPgplM5P1m6/zaB7CZl5GXVt+z1ORh3ePYjpqiP2JSX2qTPNK3kKVxKdSu+ aacIcLHzbOq1+ezS91O9YCgBrMwbd4UQJ9Jmt7VSGEMfRmMEZ+af3ddh/chK5ILyPZRB fpIV/hDIrR4t7pGT9ZiK9c/wCoI7yxAIDjVMdW1VGxys5ifcx2GJmnM9YWfDLS+tMU2a IUjqN8zwP9tkF+bkaQmIBoKj7kS9bzNXbZ3amaalykVcmB2yOoLCVsqSzEkd2EAOWGG3 0SijgrMKfB/6zAGNGRHU1ADlb+pP5pMXjjqaaCSmSMg2j19NJ+GnI1ee7xciqlMxh7xi UpDA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:user-agent :content-transfer-encoding:references:in-reply-to:date:cc:to:from :subject:message-id; bh=zojSm/EWN6Go075kn4ViSSBUsx9wOdEdCklDnsuH39g=; b=izwc/An1KRqydwQyX5bE+ZN7afmZQACP3eoXVl1DSOWC9s9ppDVnOiLLlH3TYBxMCf JSWQ8PGFTcnr9f0dAmtH3F+gV5NRzDFDIgTXx+zU/EIQiOWkqdIPS3e2gEg+PbuRdA+R qHmge9K4dgTqudEPFoQcFntPV2l6kW2UD3PVmsRFWfR21pP/HMtwEeHLyk85Qg/OiFcs cZ6cDFlACxdInMyrTdNG4WZRmcM5aMbM2osUa5ytHsa4QwKaNebU6Xx2p4AVSlpHFjEW Qhq9ZBJ6j4fHvVwgLZ+ZWvV5/HRMrfiQAj7s0SNRYKgrAPs8ayx3fw/7UNVGKh/0X+AB ZqHA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id na11-20020a17090b4c0b00b0021fd4804492si3168018pjb.179.2022.12.16.09.46.35; Fri, 16 Dec 2022 09:46:44 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231821AbiLPRcX convert rfc822-to-8bit (ORCPT + 68 others); Fri, 16 Dec 2022 12:32:23 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44950 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231817AbiLPRcV (ORCPT ); Fri, 16 Dec 2022 12:32:21 -0500 Received: from metis.ext.pengutronix.de (metis.ext.pengutronix.de [IPv6:2001:67c:670:201:290:27ff:fe1d:cc33]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4846D1D0EC for ; Fri, 16 Dec 2022 09:32:20 -0800 (PST) Received: from drehscheibe.grey.stw.pengutronix.de ([2a0a:edc0:0:c01:1d::a2]) by metis.ext.pengutronix.de with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1p6EZB-0001Q6-GC; Fri, 16 Dec 2022 18:32:13 +0100 Received: from [2a0a:edc0:0:900:1d::4e] (helo=lupine) by drehscheibe.grey.stw.pengutronix.de with esmtp (Exim 4.94.2) (envelope-from ) id 1p6EZ8-004yJk-4f; Fri, 16 Dec 2022 18:32:10 +0100 Received: from pza by lupine with local (Exim 4.94.2) (envelope-from ) id 1p6EZ8-000CZO-3B; Fri, 16 Dec 2022 18:32:10 +0100 Message-ID: <354d17d2e1e55b12428fcb50f7cfce9bea81ea29.camel@pengutronix.de> Subject: Re: [PATCH] media: coda: Add check for dcoda_iram_alloc From: Philipp Zabel To: Jiasheng Jiang , mchehab@kernel.org Cc: linux-media@vger.kernel.org, linux-kernel@vger.kernel.org Date: Fri, 16 Dec 2022 18:32:09 +0100 In-Reply-To: <20221117065652.44426-1-jiasheng@iscas.ac.cn> References: <20221117065652.44426-1-jiasheng@iscas.ac.cn> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8BIT User-Agent: Evolution 3.38.3-1 MIME-Version: 1.0 X-SA-Exim-Connect-IP: 2a0a:edc0:0:c01:1d::a2 X-SA-Exim-Mail-From: p.zabel@pengutronix.de X-SA-Exim-Scanned: No (on metis.ext.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: linux-kernel@vger.kernel.org X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_LOW, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Do, 2022-11-17 at 14:56 +0800, Jiasheng Jiang wrote: > As the coda_iram_alloc may return NULL pointer, coda_iram_alloc() may return (phys_addr_t)0, not a NULL pointer. > it should be better to check the return value > in order to avoid NULL poineter dereference, > same as the others. > > Fixes: b313bcc9a467 ("[media] coda: simplify IRAM setup") > Signed-off-by: Jiasheng Jiang > --- >  drivers/media/platform/chips-media/coda-bit.c | 4 ++-- >  1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/drivers/media/platform/chips-media/coda-bit.c b/drivers/media/platform/chips-media/coda-bit.c > index 2736a902e3df..6d816fd69a17 100644 > --- a/drivers/media/platform/chips-media/coda-bit.c > +++ b/drivers/media/platform/chips-media/coda-bit.c > @@ -854,7 +854,7 @@ static void coda_setup_iram(struct coda_ctx *ctx) >   /* Only H.264BP and H.263P3 are considered */ >   iram_info->buf_dbk_y_use = coda_iram_alloc(iram_info, w64); While this can return 0, if this allocation fails, ... >   iram_info->buf_dbk_c_use = coda_iram_alloc(iram_info, w64); ... this one must fail as well. > - if (!iram_info->buf_dbk_c_use) So the buf_dbk_c_use check is enough. regards Philipp