From patchwork Mon Mar 13 00:49:24 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kuninori Morimoto X-Patchwork-Id: 13171909 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 00F01C6FD19 for ; Mon, 13 Mar 2023 00:50:54 +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 507161434; Mon, 13 Mar 2023 01:50:02 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 507161434 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1678668652; bh=HZpjx30Se9SsQHbHbRwxCn11/vC+ZfXM4QSlLyjUbl0=; h=From:Subject:To:Date:CC:List-Id:List-Archive:List-Help:List-Owner: List-Post:List-Subscribe:List-Unsubscribe:From; b=puuwK7DEzBr3DAI8ckbGRi6fs+KB/P6SHuq15IJaqqRlCfuNQJLT3asSThTRxHmFh 1AHokD8xZ6MsSS0FUBUvtWZb7YXpFfZAfl0Dbdyqvy+uT/lutyKTll29qvHVxODEp3 eBZFfI12JoGxhCEwcwljB38B4Mli0E6ZeY8Dxln4= Received: from mailman-core.alsa-project.org (mailman-core.alsa-project.org [10.254.200.10]) by alsa1.perex.cz (Postfix) with ESMTP id BC329F80423; Mon, 13 Mar 2023 01:49:40 +0100 (CET) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 14239F80423; Mon, 13 Mar 2023 01:49:36 +0100 (CET) Received: from JPN01-TYC-obe.outbound.protection.outlook.com (mail-tycjpn01on2070c.outbound.protection.outlook.com [IPv6:2a01:111:f403:7010::70c]) (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 2B39BF8016C for ; Mon, 13 Mar 2023 01:49:31 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 2B39BF8016C 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=Uo9hAFMM ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=cOFVoCUmhi8axfWPenvbG4iea0Urwuxz1uZf48IHT56lmRbTvH6NR6IymJiaIIJyep3Xs9y9YB7TJVzLvxbjnjVsAezNSJBryItgW964pJx9Y0hPtYmm54y5qRxcOPTWxDvsjNELtmSxWRaPdeJTVCaz+plEjrvq/TteeZXSYPsyVBKVzUYQIUACoqwZtL2Wxd4IqYOj3n1puU0Y53sK++LXR1FyYDsHzcYS7lXEQRMpYLZNOg3jdC2ZvJDNG0GvyMir3x91bfPokFnPczqRITZBdBl9H1iTHbX4QTk0WtbAVo+iBQq+KFWjrIZWFpJalzVOxKQhAGWIw7EOb5InxA== 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=X9US47nuD35xEvqRoZnacdx7zhhNPe2CgNalVRs4cqv4kZ+bv8ruqL+0ICJDeexGLCya7hb6Lwq8fiq6yqZYmxy10AyWlklvBRP2P6rRkFFHXOe2OknST+86gZZKV3L6UMoy1w9YdM3OeGSm3CbuGwE5VjSsI+DzUEXp6s7oARvWLmYc4xWRzdMMi8oKy3mD2TSjZpV512YQIhG5uFe2pAEb5ahCak9nAUtiXVlqR9ZHdO7T2CRk7spibJfxgoNP1kscbm9+OYx4K+kun98PwQ49rvFbK5OEb+FA6O6L0dWKYj8PFNlWAfYSwhncJpCdCBeky/s0Cra1d1ExHxCfxg== 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=Uo9hAFMMjU3Rki5PF6cvd6HNHTgbyC5afHEwKjwDeaMaiyppovcViQt41E8KGgfh2T3PHhewdnf75+T1497o5wwaplth3YkgUcqMl+1PXH+/jmR3HyFAFSX7kxl7nZ+FcpGQQZ4D1v4Cqi+MDCfdL3v5tJP+oMJPv0Vnmcrd5Vs= 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 TYCPR01MB7823.jpnprd01.prod.outlook.com (2603:1096:400:184::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6178.24; Mon, 13 Mar 2023 00:49:25 +0000 Received: from OS3PR01MB8426.jpnprd01.prod.outlook.com ([fe80::e03e:1938:695b:f472]) by OS3PR01MB8426.jpnprd01.prod.outlook.com ([fe80::e03e:1938:695b:f472%8]) with mapi id 15.20.6178.024; Mon, 13 Mar 2023 00:49:25 +0000 Message-ID: <87ttypeaqz.wl-kuninori.morimoto.gx@renesas.com> From: Kuninori Morimoto Subject: [PATCH] ALSA: asihpi: check pao in control_message() User-Agent: Wanderlust/2.15.9 Emacs/26.3 Mule/6.0 To: Takashi Iwai Date: Mon, 13 Mar 2023 00:49:24 +0000 X-ClientProxiedBy: TYCP286CA0115.JPNP286.PROD.OUTLOOK.COM (2603:1096:400:29c::19) To OS3PR01MB8426.jpnprd01.prod.outlook.com (2603:1096:604:194::10) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: OS3PR01MB8426:EE_|TYCPR01MB7823:EE_ X-MS-Office365-Filtering-Correlation-Id: bcac34ba-e2fd-44ec-472f-08db235cca8d X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: oa2s7k0GGHuVdKOTGuZnMyoJL/U9pGz3vN1zmsCeTgJ/qi+IBDfwduV66Inb9pW4+S4Ql9wDeYk6zO4I63IDAYdShG1+7QZAcTvk8sxPPpUlE8QqegRmC87T9W0d0pUMhX0YPeq6xrrhuXgsy5AtSiHnF5SBDne9d5tORNykZDMa25nBv2Jn6g7Qycb6D9OUi/vYCDC8hcElNzvk0iXmlYUPVWszht1b5pFy3wBob4Q0Xsa9rSgzKBanuFgyN2liIeUkf8K+Pba75QIKkaQ9LfeQvMim6lcfIOZjvLEdJZa6SWIAldzg21juQC8sQXHQPta8F8rRh3/TnHCQEPnlZLxbSUlPffY2D4MhnDnEfojELynaexEtS0KSb+o38hw288wioaTwc/rYtwVj+36ayx63Khmj5t7kFK3ehF3jWDMGmpTTwutxSvmkslLxY2eObLd6yrPjnY1w/kM5pfcrnK4kudABuTE5NhfB6E+Zg6XrrNbtsXR8rD8ejWv8lqlyiKFsdkggEa//6PP/cinP1SoZxC3FPD82V6t7i/sJw25+TlLRGR0t/OhKZ9h+7J1clfAYcP6AsOgymljbupNPKnVbfoGXnz0obzHiOnin44A48F5dUQ7N6grTgQvmbyX7IkFIQtUp7VBo6oB74vAFvSlFX7EZmYVIkPaq4XMjemIr5CajwalGeehS82b20viKOc3OIbL4eFQYyF6hbevnJA== 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)(39860400002)(376002)(136003)(366004)(451199018)(2616005)(186003)(6512007)(6506007)(26005)(8936002)(83380400001)(38100700002)(6486002)(5660300002)(8676002)(66476007)(66556008)(4326008)(52116002)(38350700002)(2906002)(66946007)(41300700001)(478600001)(316002)(36756003)(86362001)(6916009);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: RbiZd/1qQnscAnOfCaZaEzvZRGoUv/Zxs/44l7OI1Z0Mcb//L/nFSPUB98rzf1SFhx4TvV20MQ+EXniFPHM4IzuI9GPndxy85PXtR+YFovuiqahQblv+BfXG2EnFclBTxGTPDvmu07rt8E9pzvXI+SdFtCgl/R5IYzcWKBwivr3233tMyDNamoMQOYihaKlg8dk2Ta1IgI1ZJNAvLysdKrVQDtYlLbFM1SNplMHqaVnQH5+T4qH3KxXkdP+sg+rkBMTGLowt/X1wHV/CGZq1cfQbYLOjrgDKLuX+dFNehgnrdVxWhzbkgu/6DyvHqQLWAGfBm1tReT5+gQIQ1cZDwBC4aqWFFcR4KuFmC0NQlz2pOnaNzMw0EpkTL8Sxv50w66SdAmyHHo7/MlzxJG7OREZIT1J8dzF1gYTQC3P6iApJtImZCEUMki0Vch5gs7hIMP0LPUOlsUO8AbyHTLxh6WCv7eQexW9VUSoqHZ0/Pybp3UBgc7ca/7y0zGk+v/spsmTZKA25cMVogZszFMkthWvoAOM9TVH4MQMvnOUqmK+dTKMUL+Cb6R/n+usaQFNs4a8wRzqvOcyahWGf5jlsRldb/uA6Mhgp2B47antFjQWQH3N4yvZdLXJnpAWj1PZkDy1lROwdChFaXW75mLJPNRuNWqYZED99zfjGpZ/0pAtIN0iTna3ysfoHkYEsqveRaWfvdlgZluwu2c7pjwx5Atqf2xFBPcSjvcXXTT0O1/UzANQ8skJk6bSX2AV8egn28W1BYr4L0mLwQaNrdT6R5HN9PHvpZZ5h4ascieFVtcTYMKUwOIEDpqWXwSkUxUPsE7cwq4oN1i+wtYM8yNYInQ++LXF06/x/TKVmU0vCaXZAfiuJshp86/01+1+TkOOnfI1A4n3ehMxxWgw04EeWsv+5rtamemiFvQTu6FDbqgf+cAXxvaqPH4+vVIl1bcv5w+u7HL2BZP6uhTaV3jxUXOEJq7Q5BHUWGDQ9Qvf1XDSJv1Pe00CIgEWyWh00JmQBThLi8yD6tKZyvIrFxQmmuh5+c9EhrrhPnivVWkXGehD3ZvPQ/3q1WC1UrdSW6+xdr1yDHnJI5dh3fRf897J66k87cRYSghi9/KEJuibpc5pB82GsCW6Ck5/iNGL9gYIXp6TaZxaI1BFvm9aSKGRAggAw8crz426RPwOd5GJ/yHa0HHBQ4LAjlFPIg27g6aRIdjuwA8hFLBecOVQRCzZKrUxD14WiECZBgRBbZUz4WQ4gvQi07Mz6G32QTJm+SI6wNldjr++F8RhGZNlp/LJ86s4UULUlWBmpTRWtrf1SowtYl6XaCkKpAneG9bUgqa/nMEJY/i6Prvk8cbARvfpaoS7nZxByiljV2FTRD5+HPA/tPlUheqvEqFZ7D9bfs6ypJ3slo+SqFXO0wYyLapW1lCi4MfCqAd6XNjltb0A/MOrVuBw6mBjHdxpy0x0Wf+7x7Wou+1HnrZFerDnlJajE5WL/QGMrhD1VDna1fUxgqUnOc6sukp0M5qM8yFHqUTP9MdbKyJJprSrRswtq7hrvYtG3K8PMvW7Q/PJHDz27KMascwuspT1NYnr24Htj0CMdeXhg0X6YizDR741L8IyFyRLISn1CKvhtmNsBAixOi2I= X-OriginatorOrg: renesas.com X-MS-Exchange-CrossTenant-Network-Message-Id: bcac34ba-e2fd-44ec-472f-08db235cca8d X-MS-Exchange-CrossTenant-AuthSource: OS3PR01MB8426.jpnprd01.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Mar 2023 00:49:25.1614 (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: 8+ndyqSm3RagKe/lfANDYdLs2oU+Ey5SeLal5DT25CEdmmQ4rXjg8cnlR/AL/sebanLhoYQdHdqcgNGea8+uxI1jSyyoc7lPVTiqT3k3fmbkHKo754v9or45/HsX1HmS X-MS-Exchange-Transport-CrossTenantHeadersStamped: TYCPR01MB7823 Message-ID-Hash: K4CJJPQKOYTLI3EH3Q2CEAGBD4V6BNZ7 X-Message-ID-Hash: K4CJJPQKOYTLI3EH3Q2CEAGBD4V6BNZ7 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 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; }