From patchwork Fri Mar 10 06:13:10 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kuninori Morimoto X-Patchwork-Id: 13168766 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 10DFAC6FA99 for ; Fri, 10 Mar 2023 06:15:12 +0000 (UTC) Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id 04B451723; Fri, 10 Mar 2023 07:14:19 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 04B451723 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1678428909; bh=HZpjx30Se9SsQHbHbRwxCn11/vC+ZfXM4QSlLyjUbl0=; h=From:Subject:To:In-Reply-To:References:Date:CC:List-Id: List-Archive:List-Help:List-Owner:List-Post:List-Subscribe: List-Unsubscribe:From; b=FO3okzm9FLXpan+RYxFagGhN1B19FmBOzuTy3SfoePCOXh3Us+8+tyuItoPu3bkXL A5JZFjK032gXZNxvtX+RPXVjscwBtmKKBFdlBpg7ubhHTtGQVkSPYRIBBBDNYF+r+G KfXfQDsu43HNGfZ9dI5IJLGVgB5O7aylc4A34JVc= Received: from mailman-core.alsa-project.org (mailman-core.alsa-project.org [10.254.200.10]) by alsa1.perex.cz (Postfix) with ESMTP id 3ACF4F8007E; Fri, 10 Mar 2023 07:13:58 +0100 (CET) Received: by alsa1.perex.cz (Postfix, from userid 50401) id A5941F8007E; Fri, 10 Mar 2023 07:13:21 +0100 (CET) Received: from JPN01-TYC-obe.outbound.protection.outlook.com (mail-tycjpn01on2072d.outbound.protection.outlook.com [IPv6:2a01:111:f403:7010::72d]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 7B923F8007E for ; Fri, 10 Mar 2023 07:13:15 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 7B923F8007E Authentication-Results: alsa1.perex.cz; dkim=pass (1024-bit key, unprotected) header.d=renesas.com header.i=@renesas.com header.a=rsa-sha256 header.s=selector1 header.b=PGoInEJv ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=oMW94CFQMyMuxO3HGLiMI6FWm69BWhdiFAwokWegAEfYtWWkFSIMuTP4ZF5ApiLNdmApf3i/8Z8/3YPbATa+Dtah/wmKvkh2m0bE63SWMUnHhIjVXwk+RDAsxCj5hhxuGkGM3YduR4DJaiv002jRezR59fNfr+1WCv+yo8nMG3LCqcz/3OBSkZlRmCfoYenLDWxaJlNoS2g6fqHsVJ5pbNTJNxp7ishHrRVqgLJ7S5syHvg097YvwYOn3eG/V7muJBWd2NstLf6cI2Kf04A1GT9KeHsRm/2Fw3wHDBoRtm6r9af6HjJYVKeR2ZLBGFluTGYq66j2iU9syDQo+EtthQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=rmDNud1kgb4WAQKdI7SN8s1Vm9fyt7CZLa3yRcI0lSE=; b=GXuwXVd8AUdYqUUwk322YQnAd0f8HQppzeRi28xdEYBn9QNW2wsXn6+Jq001aDomQYAK15vy3zS/ANDz7pC2JpygCkTJNcsKqFHnwIrtJeXBsdP1GKAg6Q+4W1O51iGiQu6JWkSppQZSjYkHArFktCilh8RMklQYtP9AlqGy36IBMRWgm03H+caKau0MK+ddxPJOe0eLd713XK/MeAn/uEqInACTUz6hO9+i6Q1so0iLfJHALT6hTgBDQLM2pYlV8Yg+BoU03jOXcIxlSru4aR74NMKLL7H+iVLT0ya/oSjEpGezrEQT4mh2KHa7iUxHD8/Hv2s+oJKdkQkLvUZuQg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=renesas.com; dmarc=pass action=none header.from=renesas.com; dkim=pass header.d=renesas.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=renesas.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=rmDNud1kgb4WAQKdI7SN8s1Vm9fyt7CZLa3yRcI0lSE=; b=PGoInEJv4Ra2XHBKG7ojcCnQpDazdX328B4gsoe2vHZePMjtXiTwiVbQp76/Jx23F9u4T/D+SjNz8FZBnqkJcxBySd6wCMKGD1sQLAaG7e1bTELqxYZQT0QIezoNGXRWiJD+3ywTKqvLwOhajr8V5pwRwBAKBxx0oiZUOHncioo= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=renesas.com; Received: from OS3PR01MB8426.jpnprd01.prod.outlook.com (2603:1096:604:194::10) by TYWPR01MB10612.jpnprd01.prod.outlook.com (2603:1096:400:2a1::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6178.19; Fri, 10 Mar 2023 06:13:10 +0000 Received: from OS3PR01MB8426.jpnprd01.prod.outlook.com ([fe80::e03e:1938:695b:f472]) by OS3PR01MB8426.jpnprd01.prod.outlook.com ([fe80::e03e:1938:695b:f472%7]) with mapi id 15.20.6178.019; Fri, 10 Mar 2023 06:13:10 +0000 Message-ID: <87edpx2ky2.wl-kuninori.morimoto.gx@renesas.com> From: Kuninori Morimoto Subject: [RESEND][PATCH 1/2] ASoC: hpi6205.c: check pao in control_message() User-Agent: Wanderlust/2.15.9 Emacs/26.3 Mule/6.0 To: Mark Brown In-Reply-To: <87fsad2kzn.wl-kuninori.morimoto.gx@renesas.com> References: <87fsad2kzn.wl-kuninori.morimoto.gx@renesas.com> Date: Fri, 10 Mar 2023 06:13:10 +0000 X-ClientProxiedBy: TY2PR06CA0017.apcprd06.prod.outlook.com (2603:1096:404:42::29) To OS3PR01MB8426.jpnprd01.prod.outlook.com (2603:1096:604:194::10) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: OS3PR01MB8426:EE_|TYWPR01MB10612:EE_ X-MS-Office365-Filtering-Correlation-Id: 54353523-c0ed-4b83-887f-08db212e860c X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: peArKdzGn/kjt8O6qtqm8xNef10Z8FYr8Akv+ZJzWXf/jQjEkgE74cxX4qlKOvnxo0cgUuRHi5suW6AokYAvoJ3xjHT9KXY7dX64BwWRCgfiuDc2dzWCyLkn71SWT4R1oupwfQASWzC2Exeq0nAp742KrsyxAUrcs70Ozwh5w/9xJee3yNnlwKIpHQPe0G4ZMSe1pfW/q//IRvWyiWsg/XGFluI9YzoeWgNXGO3pN7l+QxXiUpw3KyyedGrKU8y3dlZTGJXwR0xrbeRbfbpZO2wHze5O3OaMgfJQP0FQMlrvTQ3uG3Agtk43X8A2OiZG12qC5fjdk9kG4/rO/SgvKwBrpXl0xOLdE8AnXBkLSauaOjKfk/Vi29JQS5ayatX6EKFcznbrDjZ94wDps1Ui89KtRmTeyvf7f6TabQUe57EAhEHRhNZXQmwWYZLUE1LrVpVzyMz/b2ty58z07v+Muk0ioQF77Xe8nHkVvJqcb+VSBjCDPnglBeowaMljinUEvSdITKeGknxph86WnID9JaYOmxxyk+Ou58pWgJDMnTmJzr7u48lKewKlyYnZ4VOKqlKx4g5nHvBlmIbS/cbJ3brSQqbFFTK5azEGOAVGaYOW/C/zPGqmimxL6VhmIybgoX5IyPsX8omuFnT4iTwvCRcy4J7Q3XrKPsHrDH9timIIx0GJEOvYnBcmHpu+hIBFanyoa+cIhPSNXMmnyLo+3A== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:OS3PR01MB8426.jpnprd01.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230025)(4636009)(396003)(346002)(376002)(39860400002)(366004)(136003)(451199018)(36756003)(316002)(54906003)(478600001)(6486002)(52116002)(8936002)(5660300002)(4326008)(8676002)(66556008)(66946007)(66476007)(6916009)(2906002)(38350700002)(6506007)(86362001)(38100700002)(41300700001)(186003)(2616005)(26005)(6512007)(83380400001);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: UjBQ9JO2XngcQJK2KdjWGJwwEsFTTtAPj7ck9TACTrCU0eQXVnP8T0UjRPlV+IfEI0dWqKa5jKRnWH6sieOimWmpxicStrgOzJNrIrXlCGTeIHr45H01ZCdAtkT56wKiADR9dWphtBTEvTVkUrQ7gJYDIaF+H+bQzGGb4e/vrlhK9ZoTveFU+2SIfGQ9C/ljYiJg2BA3yqLi98Tu14QUn1HbL9iSk29pcxds9wZZCF93WOPltONhrAiizgcwPr5bBDXoNk2djidLe0a/n7dV6rlyXP0J1UDw1Tm3JKS6LyK9qgPKzCvHjFjGbwcOsShq0m4BedahoO5f3v+XWbtzvXtoFPORXaTEYQTKul3x4dJ5qrcIHiyzJukoKcHAawJbEsrBGXQtiskJwGgYJC9MlbS84vx0GfwdMeUb593CTkuHgHKfm1WKkC3QyllMw9bI9aKNWktHHUP43w9dnRmifVQBD3mlo/AgCQqYsbocYTz48Xi3KU5IhDeFmDG3rd+ukmIlvxqO/cXTFv29Un2VJpHDSa3RC1lxGFxE+sIReAKvmmpySK20Yv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orOrg: renesas.com X-MS-Exchange-CrossTenant-Network-Message-Id: 54353523-c0ed-4b83-887f-08db212e860c X-MS-Exchange-CrossTenant-AuthSource: OS3PR01MB8426.jpnprd01.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 Mar 2023 06:13:10.5799 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 53d82571-da19-47e4-9cb4-625a166a4a2a X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: aEGjuQVIofoFbfMGi6nRzDhr0CupWXBk4io42Pjbe+HyZvSGPEjE+0Mx5894uRtLDWjMie6D2Z56lGBTfjjNNDFOti3o70TLaNoM4PDUZ0OsuBKRtCCZgP37Dr7qTaDK X-MS-Exchange-Transport-CrossTenantHeadersStamped: TYWPR01MB10612 Message-ID-Hash: D25LFX6253EHVCUUDQJS3UEWLRFIQO3F X-Message-ID-Hash: D25LFX6253EHVCUUDQJS3UEWLRFIQO3F X-MailFrom: kuninori.morimoto.gx@renesas.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-alsa-devel.alsa-project.org-0; header-match-alsa-devel.alsa-project.org-1; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header CC: Linux-ALSA , Takashi Iwai , shaomin Deng X-Mailman-Version: 3.3.8 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: control_message() might be called with pao = NULL. Here indicates control_message() as sample. (B) static void control_message(struct hpi_adapter_obj *pao, ...) { ^^^ struct hpi_hw_obj *phw = pao->priv; ... ^^^ } (A) void _HPI_6205(struct hpi_adapter_obj *pao, ...) { ^^^ ... case HPI_OBJ_CONTROL: (B) control_message(pao, phm, phr); break; ^^^ ... } void HPI_6205(...) { ... (A) _HPI_6205(NULL, phm, phr); ... ^^^^ } Therefore, We will get too many warning via cppcheck, like below sound/pci/asihpi/hpi6205.c:238:27: warning: Possible null pointer dereference: pao [nullPointer] struct hpi_hw_obj *phw = pao->priv; ^ sound/pci/asihpi/hpi6205.c:433:13: note: Calling function '_HPI_6205', 1st argument 'NULL' value is 0 _HPI_6205(NULL, phm, phr); ^ sound/pci/asihpi/hpi6205.c:401:20: note: Calling function 'control_message', 1st argument 'pao' value is 0 control_message(pao, phm, phr); ^ Set phr->error like many functions doing, and don't call _HPI_6205() with NULL. Signed-off-by: Kuninori Morimoto --- sound/pci/asihpi/hpi6205.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sound/pci/asihpi/hpi6205.c b/sound/pci/asihpi/hpi6205.c index 27e11b5f70b9..c7d7eff86727 100644 --- a/sound/pci/asihpi/hpi6205.c +++ b/sound/pci/asihpi/hpi6205.c @@ -430,7 +430,7 @@ void HPI_6205(struct hpi_message *phm, struct hpi_response *phr) pao = hpi_find_adapter(phm->adapter_index); } else { /* subsys messages don't address an adapter */ - _HPI_6205(NULL, phm, phr); + phr->error = HPI_ERROR_INVALID_OBJ_INDEX; return; }