From patchwork Thu Jun 2 09:08:25 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dan Carpenter X-Patchwork-Id: 12867698 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 8A867C43334 for ; Thu, 2 Jun 2022 09:09:42 +0000 (UTC) Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id 8018B1720; Thu, 2 Jun 2022 11:08:50 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 8018B1720 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1654160980; bh=wm7bvzD/tC3P5/6ao2igdWgq1slZdGeiQpIO3f7am2g=; h=Date:From:To:Subject:Cc:List-Id:List-Unsubscribe:List-Archive: List-Post:List-Help:List-Subscribe:From; b=RB5jWdXugJ82o7JP3/q/R4g58G+hyu9/HZYCjKpYXmHHYpDO33s4G/gQ81N7M8+kP xDZ5vZhqWWKDZXnpX5/NOarveqicfI5sqokeOLmuTuosnV49O79R9cAGgvUf1wzJPT iopP+BB6t1Jkbo7AWOn7IuXfD+EgCW0WkOL2S0kE= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 0932CF80158; Thu, 2 Jun 2022 11:08:50 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 338F1F80236; Thu, 2 Jun 2022 11:08:49 +0200 (CEST) Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) (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 5CCADF80124; Thu, 2 Jun 2022 11:08:44 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 5CCADF80124 Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key) header.d=oracle.com header.i=@oracle.com header.b="LbEMFWHU"; dkim=pass (1024-bit key) header.d=oracle.onmicrosoft.com header.i=@oracle.onmicrosoft.com header.b="G5sWcT8Z" Received: from pps.filterd (m0246617.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.5/8.17.1.5) with ESMTP id 2528TMRS024869; Thu, 2 Jun 2022 09:08:41 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=date : from : to : cc : subject : message-id : content-type : mime-version; s=corp-2021-07-09; bh=oiQS+GVQGEcgdcD2KpT3sO9qB/gEEUAT9Nux4jsCSVc=; b=LbEMFWHUnK4GvA7COlOkC5ot80/P08vzXYvxyfWKAS0sFMoeOdH29ZXWb+43NnEbNm8O gRg5BUj3orXNAi2wd+LdSaASk3/C3Folq15Z6fQmmJ4Omx4nMJBYvf8AmEIh6FLxe00Z ZfS1RvoStyRKZZVliW9a/h8q47KKz4mN3c9YVe+ktVctIF45xxs2DLuvk3KQ8l9L4KHN 32LBf+zC3LmFrrGfx3BOGWRVgf8nOvJOL8xbOoMveodD+tuubgsjxmSgjj7hbfhvnUG+ Anh8ZnjehREsL+ljZE3Z0Ay/EdxazftP3ciWuEx7MvaDLE4B5q+05RnCchaJhEi+RO+6 Ew== Received: from phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta01.appoci.oracle.com [138.1.114.2]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3gbcaut18n-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 02 Jun 2022 09:08:41 +0000 Received: from pps.filterd (phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1]) by phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (8.16.1.2/8.16.1.2) with SMTP id 25290B2j012796; Thu, 2 Jun 2022 09:08:40 GMT Received: from nam10-dm6-obe.outbound.protection.outlook.com (mail-dm6nam10lp2104.outbound.protection.outlook.com [104.47.58.104]) by phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com with ESMTP id 3gc8p4pw37-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 02 Jun 2022 09:08:40 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=KAgqbBa88OHcuHOs/fFIj/5Loa9QLynn/+bl6gcrePRQ4SWed6R4TgPJ09oVZ9DCKpOn0B4veJhiHyld6hNB9Uy3i4RccE6432ZjVKNolOP5ePBGM5En+whpBcDNw6yL/PIysq4GW/2HZWehrfXe+joHzKyOcjK8eqMFXfsf9Jei3ePXaU5+m8Uu+rs8K7WtwEsDKOgag/UkVuR/KZ2+b/ywumXsMRM5/uFISG+rI8HqmiFb1pMv1+jYmBcVlfPRjT9R7Lv2TjSaesbqts79K+ijiT5Hv9EduCbCoeFs4eeZlqdyyVk3g5gmFF2B7z3Dl4upjFuSJYGOQfV0Dq54vA== 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=oiQS+GVQGEcgdcD2KpT3sO9qB/gEEUAT9Nux4jsCSVc=; b=hnsBaq6OeTYvnOLwNjov2z/MB7ouOrrgMWcj4g1WbHzRIJo4vKZ8qsv5bFmU3MJUWbj8XrNYBuPAnV+JNraDuldPc/ciunS6mVzCK79R8miLs34CqpdarWTgeoO3BCQpPP7IzqdaIDk/QjNjak3mZgGQbjj+AI1h3xeoueo5Cm1D78pvFqPC4L0ZGrt4JFqwpFaaVEMFsTstuJrYtrQkn1GaHCI3fbd73caTqalzj0jGuA6dj3anU4YYmnHvVgJAGjkjhm0M95i/KgZlKU+tm8FlCOF5lr8CujgQiGoX5lo+/IM74tAoAUsOC6nKKFN1PIqv5H2GBtwk9iB6PYciaQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oracle.com; dmarc=pass action=none header.from=oracle.com; dkim=pass header.d=oracle.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.onmicrosoft.com; s=selector2-oracle-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=oiQS+GVQGEcgdcD2KpT3sO9qB/gEEUAT9Nux4jsCSVc=; b=G5sWcT8ZsiTiIKYX9ywUkBqOAXEOKyqxiF4eZD2iKM120Jx70uuzSLT+iSGFzBmIuvkV3M0W+WjnQhJYKyHDfWPU8QDycWJc9NkgdUsYH98V3UAqc1wgZEstx6QNJMb76wrdBGoaJ1D+ZvhJWcs0GaAXLKTxw3mDzJveWCI61y4= Received: from MWHPR1001MB2365.namprd10.prod.outlook.com (2603:10b6:301:2d::28) by SN4PR10MB5623.namprd10.prod.outlook.com (2603:10b6:806:20a::5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5293.19; Thu, 2 Jun 2022 09:08:38 +0000 Received: from MWHPR1001MB2365.namprd10.prod.outlook.com ([fe80::86f:81ba:9951:5a7e]) by MWHPR1001MB2365.namprd10.prod.outlook.com ([fe80::86f:81ba:9951:5a7e%2]) with mapi id 15.20.5293.019; Thu, 2 Jun 2022 09:08:38 +0000 Date: Thu, 2 Jun 2022 12:08:25 +0300 From: Dan Carpenter To: Pierre-Louis Bossart , Peter Ujfalusi Subject: [PATCH 1/2] ASoC: SOF: ipc-msg-injector: Propagate write errors correctly Message-ID: Content-Disposition: inline X-Mailer: git-send-email haha only kidding X-ClientProxiedBy: ZR0P278CA0169.CHEP278.PROD.OUTLOOK.COM (2603:10a6:910:45::16) To MWHPR1001MB2365.namprd10.prod.outlook.com (2603:10b6:301:2d::28) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 4f8b284a-7939-475a-6cab-08da44777b04 X-MS-TrafficTypeDiagnostic: SN4PR10MB5623:EE_ X-Microsoft-Antispam-PRVS: X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: bChhFrpvYQ7iQU6AsRSUhDRoScwd7RR5Rwb1ws54LL+Z6+tkJuEKHTC1JSxgUblWdPAiQae6N/a5F5fnmJlb7MFkgTbagnRF/UmWgPBz/NvkEN/OF8OHwG+6uCZ96w/AzZr0/lw2XAy9t+cb43tdMRNeW9PWX53CPXu2+LUP/4HJG+7cfPXaTW/Y5MTCKC2hnSOg4XzokwUD/zl/+HyZDr47ulHbgDY1uGiUOJc225xdKhF0qdoLFR75H/Cxek6qv+yX08TmtY7VUA4wipmxgZpIe3DJyRCO0K8skqooUDa2YWDKAA+UCCYU/c8cs1pQ4/vioh57InmpLzvgPtdeOeOXu2BVZT++NV/jwoirbnaG41XNRErGFzB7gcINqbhyL1XUXx5RFKpL1UjeZ9NL6pUz1/OzcML7HF5uJODzBjiOXimTOek6lKryO5edxdegtrpMDm9yWgJ78bnwXH9IEWmXFtwYAWSrmln+Sey08zQmC1JyPSTWvpvmFskBc2Cl6D4nz/aYN/eE23RKPmh99Rr96JimEW9NHojyF2cZRYzKJcV0Q1eTh4Bt/q+o8ndLQrjePbc55z0mCX6t9CSq0TGammRQpXLktAk+VU2/4Dzp0GPsQXDm4BCFwespvcYFI92t7bmYIVREUOQFBaj7oZ6d3wMFxqeqNB7RJJGzgOyCjbGdwOPBQ8pEusSgUoOu9reB6NpIuVYbZi//ldDLWw== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:MWHPR1001MB2365.namprd10.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230001)(7916004)(366004)(5660300002)(33716001)(4326008)(186003)(66476007)(107886003)(8676002)(44832011)(9686003)(2906002)(6512007)(6506007)(6666004)(8936002)(7416002)(66946007)(52116002)(86362001)(26005)(508600001)(83380400001)(66556008)(38350700002)(38100700002)(110136005)(54906003)(316002)(6486002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: n/1ZjG4oJJn+rwnk+snVrooV9JI1OQToT8OdnJ6uxZe/azu+nDXOrojbT6b3wxzg9mbn91yLeQKA65sK/ibxN21ak/nFJsxs20Q/RyvO6W9xroB+MQe7gz+zDn1jZeLWHkyin5XYO01Z7UTXiNIdPjlA/N6uDG7liQlzL5salxRfLWhDkMZ3bsPqbUUNn4Xg7530SfuM5GMtihDwWVlxwULj0bOgp13orJdD6oMlXt+GOt1VcN/g6yPueUq3/6L0biBLqx/jRXS0VapdPhFsKlFitjHum+Bbt6mb1m9pKNqaYbM8fFXVcFycxFSwT8G+SuRoNDCnH4z230cYgfwRaoi+gHR+s0O1pZVt/y3pQ4dLfvUXGebQoaFg3JEYnj3F49bbLwUa/S/VVqbbSnpRRBl6CLXujdbdoki+p/zK6zyso49p42M+xfQtdPvstfAqkMAGDlMJJgemTWOAkfH1sqluyKm9Bv2BfYXLfWyS6l0yrPVsTm55H6mBAQ6fIgyKo2eof4TQV3el0X4XGOw4AXSdbGiTVxlD1+vIwJM5o6QO/AIKumIl1RyreTl6Ijak4UYgUPmDztqcd35tpAyV6sSZdX+MoFWkO0NPfS7MFsWEJ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nENHu/TV5ljs7vkeyl1w2mWy04smDvzyhU0MgfDJ3N0a25Mw5eeOpuOeJ18FP+bjs6dQMFaJFEmdVdcKBmNbJ4= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 4f8b284a-7939-475a-6cab-08da44777b04 X-MS-Exchange-CrossTenant-AuthSource: MWHPR1001MB2365.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 02 Jun 2022 09:08:38.5155 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 4e2c6054-71cb-48f1-bd6c-3a9705aca71b X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: M+hQQRFWG+bqVLoV5R7AjQXftTnBVvX7M0lYNn+hK5z58bES/P9GCe0j7/Uboc5JfHlvjvMjL1SIknX99fmqwmMKHShyXVQnrPPk10YFm0I= X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN4PR10MB5623 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.517, 18.0.874 definitions=2022-06-02_01:2022-06-01, 2022-06-02 signatures=0 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0 mlxlogscore=999 phishscore=0 suspectscore=0 malwarescore=0 mlxscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2204290000 definitions=main-2206020037 X-Proofpoint-ORIG-GUID: OZKD0HJtItofZ1Dh-Hfzk58RTXU5xQ7c X-Proofpoint-GUID: OZKD0HJtItofZ1Dh-Hfzk58RTXU5xQ7c Cc: alsa-devel@alsa-project.org, Kai Vehmanen , Bard Liao , Takashi Iwai , kernel-janitors@vger.kernel.org, Liam Girdwood , Mark Brown , Ranjani Sridharan , Harshit Mogalapalli , Rander Wang , Daniel Baluta , sound-open-firmware@alsa-project.org X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" This code is supposed to propagate errors from simple_write_to_buffer() or return -EFAULT if "size != count". However "size" needs to be signed for the code to work correctly and the case where "size == 0" is not handled correctly. Fixes: 066c67624d8c ("ASoC: SOF: ipc-msg-injector: Add support for IPC4 messages") Fixes: 2f0b1b013bbc ("ASoC: SOF: debug: Add support for IPC message injection") Signed-off-by: Dan Carpenter Acked-by: Peter Ujfalusi --- sound/soc/sof/sof-client-ipc-msg-injector.c | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/sound/soc/sof/sof-client-ipc-msg-injector.c b/sound/soc/sof/sof-client-ipc-msg-injector.c index 03490a4d4ae7..030cb97d7713 100644 --- a/sound/soc/sof/sof-client-ipc-msg-injector.c +++ b/sound/soc/sof/sof-client-ipc-msg-injector.c @@ -150,7 +150,7 @@ static ssize_t sof_msg_inject_dfs_write(struct file *file, const char __user *bu { struct sof_client_dev *cdev = file->private_data; struct sof_msg_inject_priv *priv = cdev->data; - size_t size; + ssize_t size; int ret; if (*ppos) @@ -158,8 +158,10 @@ static ssize_t sof_msg_inject_dfs_write(struct file *file, const char __user *bu size = simple_write_to_buffer(priv->tx_buffer, priv->max_msg_size, ppos, buffer, count); + if (size < 0) + return size; if (size != count) - return size > 0 ? -EFAULT : size; + return -EFAULT; memset(priv->rx_buffer, 0, priv->max_msg_size); @@ -179,7 +181,7 @@ static ssize_t sof_msg_inject_ipc4_dfs_write(struct file *file, struct sof_client_dev *cdev = file->private_data; struct sof_msg_inject_priv *priv = cdev->data; struct sof_ipc4_msg *ipc4_msg = priv->tx_buffer; - size_t size; + ssize_t size; int ret; if (*ppos) @@ -192,8 +194,10 @@ static ssize_t sof_msg_inject_ipc4_dfs_write(struct file *file, size = simple_write_to_buffer(&ipc4_msg->header_u64, sizeof(ipc4_msg->header_u64), ppos, buffer, count); + if (size < 0) + return size; if (size != sizeof(ipc4_msg->header_u64)) - return size > 0 ? -EFAULT : size; + return -EFAULT; count -= size; if (!count) { @@ -201,8 +205,10 @@ static ssize_t sof_msg_inject_ipc4_dfs_write(struct file *file, size = simple_write_to_buffer(ipc4_msg->data_ptr, priv->max_msg_size, ppos, buffer, count); + if (size < 0) + return size; if (size != count) - return size > 0 ? -EFAULT : size; + return -EFAULT; } ipc4_msg->data_size = count; From patchwork Thu Jun 2 09:09:35 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dan Carpenter X-Patchwork-Id: 12867699 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 EB14FC43334 for ; Thu, 2 Jun 2022 09:10:52 +0000 (UTC) Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id 008171740; Thu, 2 Jun 2022 11:10:01 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 008171740 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1654161051; bh=x5EDPeQMv3q33yhNRq3oz2Q7XgHzXh0H34JBZu9FNNE=; h=Date:From:To:Subject:In-Reply-To:Cc:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From; b=iu9vmvMJh81oxcE3r6/BUIsEJVRHD65hidp/bSDgilf4t1Su8S4mZuI888MRfFpXi NNa5iRUyK8FXl8NhujqO5YSirL/kVygND6jXNqOZRityh1RrAwaF2Wpj0oyISS+EDj hCt0j3xL5lVLX+KJh5ScLFRIpg2pycw9cKvCaNCk= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 9F05AF80158; Thu, 2 Jun 2022 11:10:00 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id D18D8F80236; Thu, 2 Jun 2022 11:09:58 +0200 (CEST) Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) (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 E29C0F80124; Thu, 2 Jun 2022 11:09:53 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz E29C0F80124 Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key) header.d=oracle.com header.i=@oracle.com header.b="s8ITVzTX"; dkim=pass (1024-bit key) header.d=oracle.onmicrosoft.com header.i=@oracle.onmicrosoft.com header.b="JQhDWKWq" Received: from pps.filterd (m0246627.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.5/8.17.1.5) with ESMTP id 2528TS48020499; Thu, 2 Jun 2022 09:09:51 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=date : from : to : cc : subject : message-id : content-type : in-reply-to : mime-version; s=corp-2021-07-09; bh=+NvTtdPxVv4L+NmIYTezbe7PQQVJ728tod1uWudzs+Y=; b=s8ITVzTXvSaSIpSFKwlza/hlATGim8RvMlXLHwu2Nr6Q9Tjj3ZqFvv8ESmKC9ym0t5Un WAmHLxrELvq70xBYSCSAdY6OpcD3afHI0P5fM/4xXkL+Nw7ef6yUqZqflC8WU6p8tRKq ket3vU1+/DrZ47nrnGVTPdzORbwkswaB+5CYX5mcCueh1SChiMIo9g3SXYA/EqMgszFi 6kU8jCuy1r00Gk4Qh0VgMN2Dlr6zPCws+OWyHCWKOmgjDoQn5+4r5/VoYor9hvYwxlpl rFn2L3A3d8kDfUJwANntpKEoR+KaR0qLWvIx80MXbeOpyU/a2WQU1h9ApoFIQScrz7B9 6w== Received: from iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta01.appoci.oracle.com [130.35.100.223]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3gbcahsxtt-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 02 Jun 2022 09:09:51 +0000 Received: from pps.filterd (iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (8.16.1.2/8.16.1.2) with SMTP id 25291WNE028449; Thu, 2 Jun 2022 09:09:49 GMT Received: from nam10-dm6-obe.outbound.protection.outlook.com (mail-dm6nam10lp2106.outbound.protection.outlook.com [104.47.58.106]) by iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com with ESMTP id 3gc8k18t21-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 02 Jun 2022 09:09:49 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=IJBkXcqWjNOU5qSxDeXOhIJ+iD6k07ePdWfl+ggaoBgmiOnfEFeatha/9lTxZVyKvfeWhS7H2DTqzqhmENcFxBjbSzpeQH07C0CyIie30NgGv71YmN2VsZs9E77Bd2lXy3MAb6FdC//1tMTA05zk/DTeMgPN+C099EXJb/bekbrRhI2EpThJl8DvXeedjVa0DDLBBtXQIYWo4wQtZX0buTUv8nB5pH2yrsevlRu28d5M1g43P4+S8fbAjuSEjrVIRexdJy6XOHNJWx8M8MFiSdKap5D5y1XEYpLN4uDxfN43nTlhKGzymAiI4CAlKX5DHqvgrXYgLSdPzqDaEIkNsg== 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=+NvTtdPxVv4L+NmIYTezbe7PQQVJ728tod1uWudzs+Y=; b=A83M6W0zNkowhbMORzh/GBCVyXS0gnnwqE8epwr2g6olg2/O476eB1uZot7f8xmXBtal9F8Ih5nPSai3h+Ha+LxZRCfMRs+ubmRQbP2lNl74s96pVTpCMg68baPFmg0mJTfFiH3hbv43r2TgJ7SUYeD92O8IcUlO57A3em8HNzXx7lRgekvY/zoAcBTFaGb2Dz7BKumXMZa+F0B5qEy/PIWcDzKH39jn9Pfiik+E1Tz4Q9NdhmGD3mUITe4hxnADpgV6PtUVDbeLv03fXVekfPwk7xNmqJTfPx10wnxymPczQrJaHveAX/bJQ/d3Os6awkYEE7aa7g1424+vYgM49g== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oracle.com; dmarc=pass action=none header.from=oracle.com; dkim=pass header.d=oracle.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.onmicrosoft.com; s=selector2-oracle-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=+NvTtdPxVv4L+NmIYTezbe7PQQVJ728tod1uWudzs+Y=; b=JQhDWKWqMkz3g/qTB30ABmxvrbZ21sS5uu0/B5PMDGdH60Axy3UP2jA0W6vV+GqIkkN9YefW6buwSWr9WU6rHSCVHPvi3lvsjcMlGQaNDOGfiK1b7rUTTr/USBfEJrvKV8wVS6H0+mOGQubLxWgYICT+n3EBo9LMUSQsHl1GPRc= Received: from MWHPR1001MB2365.namprd10.prod.outlook.com (2603:10b6:301:2d::28) by SA2PR10MB4474.namprd10.prod.outlook.com (2603:10b6:806:11b::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5314.13; Thu, 2 Jun 2022 09:09:47 +0000 Received: from MWHPR1001MB2365.namprd10.prod.outlook.com ([fe80::86f:81ba:9951:5a7e]) by MWHPR1001MB2365.namprd10.prod.outlook.com ([fe80::86f:81ba:9951:5a7e%2]) with mapi id 15.20.5293.019; Thu, 2 Jun 2022 09:09:47 +0000 Date: Thu, 2 Jun 2022 12:09:35 +0300 From: Dan Carpenter To: Pierre-Louis Bossart , Peter Ujfalusi Subject: [PATCH 2/2] ASoC: SOF: ipc-msg-injector: Fix reversed if statement Message-ID: Content-Disposition: inline In-Reply-To: X-Mailer: git-send-email haha only kidding X-ClientProxiedBy: ZR0P278CA0140.CHEP278.PROD.OUTLOOK.COM (2603:10a6:910:40::19) To MWHPR1001MB2365.namprd10.prod.outlook.com (2603:10b6:301:2d::28) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: eb52588b-417a-432c-259d-08da4477a462 X-MS-TrafficTypeDiagnostic: SA2PR10MB4474:EE_ X-Microsoft-Antispam-PRVS: X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: HgJMX1vh+Pqb9c2+EMGEx0ziSavdfzrxPLyH+r0ly0Ekv/UbDaFDs22C8TP5WAz0xNyafR35UZfGGHnzuzkcI31O3j7ja2M4he0Dn6MQLuwGiZx7eAEEyv/tj7kpp3EM3qGB01B0E9sy/EJ+5V7aS0WMzz3Vb012I0tYv5OpvTqi9hMAuJ++GWWM0a13+uwGeziokwFDTw0TONXswrYxBjSeZrSOFcecCC/my85QZbMl0taJz3nA/wdQPOumFSw0i2qidFTKIWXWJSrdslzaYNdaOcI3U7HMBurnjivRDW3lBiek3h3L4L9XtbIhUlxCvo8ct48A+eW0CC0z2gn+fHtGfa33wfl9HO0O9ric8yMsLAsya0vbgsVyDD+DKdUsoFyYzPHXpZzgmN+uhSLTYpf7kmwfJ6KbCf1ACwmNpSgIP0fFzBupVpOLPKSK9oTMvAVkwRFWxvZV1TlZx5lYiEky1BuwGkI+qRjjWq6FPl94utusBZ5twTlOX5Kw/S4cH47LYJXSfIIQ7yeSwsowoAGRwWia4zkcQVnE8pk2RTs8JGCVkcUg+NLWgFX2KUjwArm061KrhdopPVP8byd4m8NoP+IsWYgLHwnn/IrRRL7ne3t/9/us7NyWqnmE6HqIUfmWMCoj4z46b+Cda7C8YxwIlpy6SX7lR8MLjOGEROPmXSH0d+PpyOjJu9MLckAAKVosjdQif/vGft1poGGoQKk6rW18VtPEpAPHN0U0hcY= X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:MWHPR1001MB2365.namprd10.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230001)(7916004)(366004)(186003)(83380400001)(66946007)(38350700002)(38100700002)(66476007)(66556008)(316002)(4326008)(5660300002)(2906002)(8936002)(44832011)(7416002)(54906003)(26005)(6506007)(6512007)(6666004)(9686003)(52116002)(110136005)(508600001)(6486002)(33716001)(8676002)(86362001)(67856001); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: kcXK5cWs5xXyc7CMqGNjHbXsrSyJgR/Zr3Zis4bMpPZ/Y5j/FqmZOKCo7aISbmgrksCI2LOSdhEiiqzE6TNLZZJBhvvuD9v6qDKRjXJ2TqH5x6hF3mdgpUNI+FVHXLZ1rZxtjeGVpyzVMGE2vP7Sb9CKLP9AtdEBIXyoelbtUpq/9L88jCTtIqaHBR8E9GIBoLkW2CKIw4kAE6EJhNzyARsBICaQ5myTnNYHXEFRdy7u4QNmRYEuC56/JmaMh/QSbSM2qRKo8JjvkmCs3Sqc+bLWAQbucbFCD2nqK3zBrH4O4/nb04EfjYPAcuxP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7bSi+HECte8T3MQzQ2PoxKYmL2hae7FIcKRZz7CeM7nUKRHccKMZxwSkI81NtDcctaRgCbXDKwZK7GvDwF+ghDS2H64cTQ6EQZeOHXKvq4uDba+wDYDbGSdk+93IJHDKjvA/9/FYlrC9Jws7ba/hVjF1ZjHculEcgRP88IEDH1xzU6yufyZkjBQYtji4z3DjmK8AFVOyR9zD+n1jb7O9NVDcnEImjxNapcotRmMPVx+tNnrkNCnQxDmiUS/HXAR+VSQFXZBlYc03Ak1LQAh6FGIjjWgeSy6FUxxdUvLwPbXC0HYm5u0C9u6+417oQT70wANuLM7B3XPwa2gQbDTr2ueLcJIL9bmtPyvfADs= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: eb52588b-417a-432c-259d-08da4477a462 X-MS-Exchange-CrossTenant-AuthSource: MWHPR1001MB2365.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 02 Jun 2022 09:09:47.7132 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 4e2c6054-71cb-48f1-bd6c-3a9705aca71b X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: SP51cJ3Le8RNqExJ4+KmCaz/k8PGHol5ALGljLQFPjmYPQlUzfY/d+DJdOrLS9dRT4+2702XR4uhkdUUx7pF5Ut8gr11HG8h88/huIoV0HI= X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA2PR10MB4474 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.517, 18.0.874 definitions=2022-06-02_01:2022-06-01, 2022-06-02 signatures=0 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxlogscore=999 mlxscore=0 suspectscore=0 spamscore=0 phishscore=0 malwarescore=0 bulkscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2204290000 definitions=main-2206020037 X-Proofpoint-ORIG-GUID: cMSD2OMfgMsPG5ViKE14Dby5dMDI7ldW X-Proofpoint-GUID: cMSD2OMfgMsPG5ViKE14Dby5dMDI7ldW Cc: alsa-devel@alsa-project.org, Kai Vehmanen , Bard Liao , Takashi Iwai , kernel-janitors@vger.kernel.org, Liam Girdwood , Mark Brown , Ranjani Sridharan , Daniel Baluta , sound-open-firmware@alsa-project.org X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" This if statement is reversed. In fact, the condition can just be deleted because writing zero bytes is a no-op. Fixes: 066c67624d8c ("ASoC: SOF: ipc-msg-injector: Add support for IPC4 messages") Signed-off-by: Dan Carpenter Acked-by: Peter Ujfalusi --- sound/soc/sof/sof-client-ipc-msg-injector.c | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/sound/soc/sof/sof-client-ipc-msg-injector.c b/sound/soc/sof/sof-client-ipc-msg-injector.c index 030cb97d7713..6bdfa527b7f7 100644 --- a/sound/soc/sof/sof-client-ipc-msg-injector.c +++ b/sound/soc/sof/sof-client-ipc-msg-injector.c @@ -200,16 +200,14 @@ static ssize_t sof_msg_inject_ipc4_dfs_write(struct file *file, return -EFAULT; count -= size; - if (!count) { - /* Copy the payload */ - size = simple_write_to_buffer(ipc4_msg->data_ptr, - priv->max_msg_size, ppos, buffer, - count); - if (size < 0) - return size; - if (size != count) - return -EFAULT; - } + /* Copy the payload */ + size = simple_write_to_buffer(ipc4_msg->data_ptr, + priv->max_msg_size, ppos, buffer, + count); + if (size < 0) + return size; + if (size != count) + return -EFAULT; ipc4_msg->data_size = count;