Received: by 2002:a19:771d:0:0:0:0:0 with SMTP id s29csp1249521lfc; Wed, 1 Jun 2022 13:04:07 -0700 (PDT) X-Google-Smtp-Source: ABdhPJys8nV7WfyQGZDYStRuu23e7OFOl0xvbbhWunCy/6XT09mc/lUaTzB5nUjLvXWNji1vqyqh X-Received: by 2002:a05:6a00:1595:b0:518:a5b2:28d7 with SMTP id u21-20020a056a00159500b00518a5b228d7mr1187288pfk.80.1654113846949; Wed, 01 Jun 2022 13:04:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1654113846; cv=none; d=google.com; s=arc-20160816; b=FU2MOy32gHozbM+z812mgWshXP4RSkh6N28AeCx02i79AlhZFmzqcpIUPYIMIoCDWD DuG9S8dpeQY603jpsjrA781pQyNsVeHhHm/wB0j3HwmwOdn9GB7xesswigiLHwo9DWt4 Wf+NJVjuV0yy4mXiffJMBgMpKpbpmqZccF712H7AruooR9nECMtwLpcYDynJyQfWKxq/ Kd0f0Bgu1IShRaEHVg8DvGkSj3Y/vPw/iKcneTkMmHhGN+YBwD6Vm6FzAyypCxWChG7N x/rSuXfOiqXg9SSD38EgJF77tQMmDA86YU2ZdEyZIJE+uukk6O8ckkoLT2geZlSprvWL jDBQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:subject:user-agent:mime-version:date:message-id; bh=GsUMSSk/J3Ci3hREnw1fmzZZE02WDPnSHWtcyyu5ZMo=; b=a8wb/ghl2oflydmpewyQyVogxWHMcjB4ZHk9JoBcRQMpa6d8YBmF5WgoxwbqOCi3Sy Mkm5UQ9TirYZPNsBPMfmCvkAXyikyV4qJdWyTLxB7y6879qXK3ERGllUmID/4M+D1+Qy WeL3rYIKDW/9WqGJZhaX5kA0+4CygNwRCdBHg6OQpBFuhYn9uCYNNihbiFWqmg4GNao3 Q9+CxVVpPiT65OFHiEdw8QoNwrZvg2PFxnvlCOV0F/riQhNZNwx22JNN3CyfgW6YVmbS qRRnN7g1GV3yML0ZlV3PvmopN1mg2os7FDUIv7P2bS3Yp3eGVeC5q+lhcCNsA2Xy0wCM f14g== 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:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id d23-20020a630e17000000b003fbfe86551fsi3308869pgl.301.2022.06.01.13.04.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 01 Jun 2022 13:04:06 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 50675220FF7; Wed, 1 Jun 2022 12:21:03 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242337AbiEaBls (ORCPT + 99 others); Mon, 30 May 2022 21:41:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52718 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232076AbiEaBlr (ORCPT ); Mon, 30 May 2022 21:41:47 -0400 Received: from mail.meizu.com (edge07.meizu.com [112.91.151.210]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 89C1E21BB; Mon, 30 May 2022 18:41:44 -0700 (PDT) Received: from IT-EXMB-1-125.meizu.com (172.16.1.125) by mz-mail11.meizu.com (172.16.1.15) with Microsoft SMTP Server (TLS) id 14.3.487.0; Tue, 31 May 2022 09:41:41 +0800 Received: from [172.16.137.70] (172.16.137.70) by IT-EXMB-1-125.meizu.com (172.16.1.125) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.14; Tue, 31 May 2022 09:41:41 +0800 Message-ID: <4c7f6aa3-4463-81f7-fe6e-8428286a42f2@meizu.com> Date: Tue, 31 May 2022 09:41:41 +0800 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.9.1 Subject: Re: [PATCH] media: atomisp-mt9m114: Fix pointer dereferenced before checking To: Tommaso Merciai CC: Mauro Carvalho Chehab , Sakari Ailus , Greg Kroah-Hartman , , , References: <1653897481-25681-1-git-send-email-baihaowen@meizu.com> <20220530112232.GB99280@tom-ThinkPad-T14s-Gen-2i> <20220530113750.GD99280@tom-ThinkPad-T14s-Gen-2i> From: baihaowen In-Reply-To: <20220530113750.GD99280@tom-ThinkPad-T14s-Gen-2i> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8bit X-Originating-IP: [172.16.137.70] X-ClientProxiedBy: IT-EXMB-1-126.meizu.com (172.16.1.126) To IT-EXMB-1-125.meizu.com (172.16.1.125) X-Spam-Status: No, score=-3.1 required=5.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,NICE_REPLY_A, RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE 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 在 2022/5/30 下午7:37, Tommaso Merciai 写道: > On Mon, May 30, 2022 at 01:22:32PM +0200, Tommaso Merciai wrote: >> On Mon, May 30, 2022 at 03:58:01PM +0800, Haowen Bai wrote: >>> The info->data is dereferencing before null checking, so move >>> it after checking. >>> >>> Signed-off-by: Haowen Bai >>> --- >>> drivers/staging/media/atomisp/i2c/atomisp-mt9m114.c | 4 +++- >>> 1 file changed, 3 insertions(+), 1 deletion(-) >>> >>> diff --git a/drivers/staging/media/atomisp/i2c/atomisp-mt9m114.c b/drivers/staging/media/atomisp/i2c/atomisp-mt9m114.c >>> index 00d6842c07d6..3c81ab73cdae 100644 >>> --- a/drivers/staging/media/atomisp/i2c/atomisp-mt9m114.c >>> +++ b/drivers/staging/media/atomisp/i2c/atomisp-mt9m114.c >>> @@ -616,13 +616,15 @@ static int mt9m114_get_intg_factor(struct i2c_client *client, >>> struct camera_mipi_info *info, >>> const struct mt9m114_res_struct *res) >>> { >>> - struct atomisp_sensor_mode_data *buf = &info->data; >>> + struct atomisp_sensor_mode_data *buf; >>> u32 reg_val; >>> int ret; >>> >>> if (!info) >>> return -EINVAL; >>> >>> + buf = &info->data; >>> + >>> ret = mt9m114_read_reg(client, MISENSOR_32BIT, >>> REG_PIXEL_CLK, ®_val); >>> if (ret) >>> -- >>> 2.7.4 >>> >> Hi Haowen, >> Looks good to me, thanks. >> >> Reviewed-by: Tommaso Merciai > Hi, > My bad, Dan is right. Nothing to fix here. > Sorry for previous review. > > Regards, > Tommaso >> -- >> Tommaso Merciai >> Embedded Linux Engineer >> tommaso.merciai@amarulasolutions.com >> __________________________________ >> >> Amarula Solutions SRL >> Via Le Canevare 30, 31100 Treviso, Veneto, IT >> T. +39 042 243 5310 >> info@amarulasolutions.com >> www.amarulasolutions.com hi, Dan Thank you for pointing out. I'm clear now. -- Haowen Bai