Received: by 2002:a05:6a10:413:0:0:0:0 with SMTP id 19csp1039189pxp; Thu, 17 Mar 2022 01:11:19 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxKBc+n2JKMEqf1Kh4drEwz3kiiQOcZilXXMwy3SbKB+nHJ5uXZcEvO984zntB2wRSCzeDN X-Received: by 2002:a50:9d47:0:b0:40f:9d3d:97b6 with SMTP id j7-20020a509d47000000b0040f9d3d97b6mr3069942edk.392.1647504678840; Thu, 17 Mar 2022 01:11:18 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1647504678; cv=pass; d=google.com; s=arc-20160816; b=UmGNYfKda6uQJwshSJTXFI6B+uJCF7zE+fbi+pi+F39dNmJRONPwBUDdExZ74vyw55 uEViSQxDwFzFX3DnJkFdLslMM5kJOH3teuMV+em+0hsTdyHg/H1PDGkkSBbdaF9eD51G V3tiQufq+dcMN4Q62sVkLDjKiQhH4QeJJszCK4i5vGprVKUu6cNrqFQiiExLceGf9w0w DQwsZzPBon0H+0s5/vRbLHMwuz76XPa4H6ZeOsH41Bqtqbbk/XLKQfJyJX1qZBLryALw x+NyXKL59ub9A/tfZGg05/o1RAgledlNbHnVXPspH00Gf0QQ4c4k9SZ2R0hrd4vkoplV /gAw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:content-transfer-encoding :in-reply-to:from:references:to:content-language:subject:user-agent :date:message-id:dkim-signature; bh=2TT1BbLE0dKSi7i9LFluVaG481IREHPR0NXb6VkIQSA=; b=GjNhJNd8Y7rBwiJgzzL/xG+U1ecrGU8KJbN4a+wYAuLrgd4+MpfYG8AZ6ycZHdjpnE 0Goim+uOxXbEKdRYEH5PWVP1DvRYbAJiDuBQlr96l4FGE09CqW2/9WxWVvONk0w7w3OH N2ldJXFq0SkxlzCY+x88ZRXdwcsggwSZ/DtkYkCdX9EQUOhdbuBKStTYp2Nq2SBluzaA 7TrVK2hqYvPBM8sJtCEVwd0pO9zNyUD9IXd/zWNuSmaUy8Q/j/XZ4RHfqz2iF8yeSiUM gdPkl5VmwEusZEErDpRCfFSobpRYQqsKcxd+Ae9omtfaNhRwWr1TnM/s1VVohUa0MMl5 JjSQ== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@os.amperecomputing.com header.s=selector2 header.b="DAmTDZp/"; arc=pass (i=1 spf=pass spfdomain=os.amperecomputing.com dkim=pass dkdomain=os.amperecomputing.com dmarc=pass fromdomain=os.amperecomputing.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; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amperecomputing.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id a8-20020a056402236800b00418fc1f103csi428929eda.388.2022.03.17.01.10.53; Thu, 17 Mar 2022 01:11:18 -0700 (PDT) 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; dkim=pass header.i=@os.amperecomputing.com header.s=selector2 header.b="DAmTDZp/"; arc=pass (i=1 spf=pass spfdomain=os.amperecomputing.com dkim=pass dkdomain=os.amperecomputing.com dmarc=pass fromdomain=os.amperecomputing.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; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amperecomputing.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230306AbiCQHqv (ORCPT + 99 others); Thu, 17 Mar 2022 03:46:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60722 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229447AbiCQHqu (ORCPT ); Thu, 17 Mar 2022 03:46:50 -0400 Received: from NAM10-MW2-obe.outbound.protection.outlook.com (mail-mw2nam10on2106.outbound.protection.outlook.com [40.107.94.106]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0299ABF01A; Thu, 17 Mar 2022 00:45:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Pabr0xoDhvoyEgGT/UYFTo6g57SF9btUbXbYygXh5tN+JTgDCtcD6Ip495D8P4f5bwiL1KawcI2fZtuJDJ4mR0zBImn10yxPWqvL41P6IJZVRs4Cz4o1rLdDcr3Rfd5KQaIRHrvxTPFFcB9JdvZ7mH8csVC/mG7amrxGEq8EpYwCtxByVSG0RA95aMi3KzDWkMDukFfKlFwOmSIWX9P5EwyccgPFTCp8HVBw33inQoznKb5MkqVeFWNvT/nkGo3nDFODPLWq3/Zcxm12jy0RnKgcfl7Aip2aTO/VSz0nfQ4yUIeVOFy9LTiwTwR86Ct+QwDmQCMPSpYM7PNMWFp9JA== 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=2TT1BbLE0dKSi7i9LFluVaG481IREHPR0NXb6VkIQSA=; b=iBeSpOTdB6lBK5Ea/OQrPNt4LG7sEWGL9oc8+djr2BbMAxKwQNY5S0aHse7QYXpHjaB2znWjvb7MJKYMVYKC1fCKeOaCKD0cEGFJ1Wf+iBuZMzaBLiQsGGlOSNIKN6g1sUTU8nLyq9k0l+p8aNOzTOvcmsYMWo2e+pivfBcqNsCXVlb8bByHjxV53XlWWYrTNInjNsYziTjPvEEj8Zy14jDbcRik4Pf21nvJ+OzPUAw20llEHDgoOEG+QAmzpwHN8V+g+emdx8mQeF0BtKpS3mtOlCXV1QcWQQeGSxfScCVEkSDSB4Bpzi4GLi8ydwKwQ88ZJYL7+MNnH2/yWPZR7w== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=os.amperecomputing.com; dmarc=pass action=none header.from=os.amperecomputing.com; dkim=pass header.d=os.amperecomputing.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=os.amperecomputing.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=2TT1BbLE0dKSi7i9LFluVaG481IREHPR0NXb6VkIQSA=; b=DAmTDZp/yzni0PijX7J7JACoFoTEnkNSYARHkI5Rnj0CHnSk+PmLPppGdkpNIb3WzNY2Pxw9nAs2Eb+0jitRJZYB3hLn/HvsUzP7CF0riZB/PJaU/DdOOy2KDR3F2uibNiSm9ehK+hn0SWCAHnXCPVnNqCglvWAcL9vD63LR+5c= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=os.amperecomputing.com; Received: from SJ0PR01MB7282.prod.exchangelabs.com (2603:10b6:a03:3f2::24) by DM6PR01MB4283.prod.exchangelabs.com (2603:10b6:5:1d::27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5061.26; Thu, 17 Mar 2022 07:45:32 +0000 Received: from SJ0PR01MB7282.prod.exchangelabs.com ([fe80::cd24:39ed:7042:46d6]) by SJ0PR01MB7282.prod.exchangelabs.com ([fe80::cd24:39ed:7042:46d6%8]) with mapi id 15.20.5081.017; Thu, 17 Mar 2022 07:45:32 +0000 Message-ID: Date: Thu, 17 Mar 2022 14:45:19 +0700 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:91.0) Gecko/20100101 Thunderbird/91.6.0 Subject: Re: [PATCH v6 3/4] ipmi: ssif_bmc: Return -EFAULT if copy_from_user() fails Content-Language: en-US To: Dan Carpenter , Wolfram Sang , Corey Minyard , Rob Herring , Krzysztof Kozlowski , Joel Stanley , Andrew Jeffery , Brendan Higgins , Benjamin Herrenschmidt , openipmi-developer@lists.sourceforge.net, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-aspeed@lists.ozlabs.org, linux-kernel@vger.kernel.org, linux-i2c@vger.kernel.org, openbmc@lists.ozlabs.org, Open Source Submission , Phong Vo , "Thang Q . Nguyen" References: <20220310114119.13736-1-quan@os.amperecomputing.com> <20220310114119.13736-4-quan@os.amperecomputing.com> From: Quan Nguyen In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-ClientProxiedBy: HK2PR02CA0157.apcprd02.prod.outlook.com (2603:1096:201:1f::17) To SJ0PR01MB7282.prod.exchangelabs.com (2603:10b6:a03:3f2::24) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 63223b2b-a7e6-4583-7619-08da07ea1c97 X-MS-TrafficTypeDiagnostic: DM6PR01MB4283: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: +V0CdS9yUxLg2Dqc5BgXYGbS/LcPrbLY4LpUt76yocRgcg1XU0tVAGqRM4/93qeyPaIpepXolGDaxtAZvNDNDo4+CBtEy4Hs0E7KLscwLqj2fkp+v1M4k2c5f9Z/24cV9M6Y6NzS6LBm7JpuewXncnp0pvoOp16Bq18h34kPJVir9agv1Gavh+4tYf8JdxsCFzRMTR3GVmrZhmNWKHVMhhHV1XtpsVJXl8x8ZBfPQmVVkVjecAagWLkigPo+ngmSA9ARajgRJSInTz5d7HXN2g3O0+a3KBTs9gZMtAMJV00P2eWN//irR2IGpzn4prfjIEU4Sx/jvgDwr6TBOA+QJNoKpetuFBnlE42MXJgHUF63KfJkPmWg2dm3YptA/pMoxD9AatI4nQrnS4qIrH1qt3wmtVEt9NKzOB8Ba8IRRwQWSAkEwHM5NmKrF2MJQso0c15IvHdD0N0IRuoUckXHRWQsz6olgyPjcLR69DpAI22t3UQTP3Llzj0sqltHFQPm1yA6AIGFsjrztJcMYdipwBODcaS8KPEjO+673QF+MIJvsjVni5X855yQLr/e5fbPEXA24aSTfZ3CI99Z/MtMKiIUZ9uq+ooRhCquT34HUM+R9cdbE2nZ+g4Qw3Krs/sjCQ2OgwaC2pbQJw8DzHatp8qrGfu4f0lDlHNsXLVaYNZ+2ZAK6ZJou3u3I2715ylqYX9S6NPWRlp0HzLUa/PSRRnbx6zIvEyNrvP1jaRPr7/4MvleJVXW4xfE+mEWhn/T X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:SJ0PR01MB7282.prod.exchangelabs.com;PTR:;CAT:NONE;SFS:(13230001)(4636009)(366004)(6666004)(8936002)(38100700002)(38350700002)(921005)(66476007)(66946007)(66556008)(86362001)(31696002)(53546011)(6506007)(55236004)(8676002)(6636002)(316002)(52116002)(508600001)(6486002)(6512007)(110136005)(7416002)(2906002)(186003)(26005)(31686004)(5660300002)(2616005)(83380400001)(43740500002);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?N21CV2NwWVZTbGZQNDBGeFJ4SFBHOFNMSnZsczFJaktMdkZiamxoMlBNK2p3?= =?utf-8?B?UXpyaU1rZ1g0Z1RWUDhZbnZaL1RaRUcrQVU5ZVFTYzZhb3ZOd3IxQTY3SVRB?= =?utf-8?B?Q0t5RkhCTGl0akFRS0lkY3VUeVNVUnBNN2FIRzU2dmMweDVhR3B0c0gwc0FW?= =?utf-8?B?cUpOQjVMd3FTUTNaaTdmanZPZnVtMjA2Z2dyTENrbWd2MWVJbThHVlVYeGJH?= =?utf-8?B?MktudDRGL0MyZ1FkVm1jZEVyajVRV2h1UmZISGpmVU55NXBnYW1tYkFl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bU13S2xVTWlKZzNpQ3gz?= =?utf-8?B?d1ZSZlVhS1p0bTFFcWZOVlBkc0ExYXNjRGlubllKemc3WDhINDRXZzRUY2Ru?= =?utf-8?B?SVJpSjZvalVPOXR0UytNbHdiMnFHd3FjUUp5SURadFp4TEFTTW1NeTczcjBH?= =?utf-8?B?ZHIzblZtbUNuQmUwajFteUdGSW9NNFV1RStnS0FhRWk3ZmUraW9KQ0lwbHJa?= =?utf-8?B?Q0M2SDR4clNXNjkxdndpT0VsdnY2WU1oWUZsS0xvMlJUTUlIWE9JbklNMXM4?= =?utf-8?B?eWxsYlRmaHVycWRnRDd3WDRZdzNwNG9qZTFSb1picmQ4VWFmTzNacHNYYS9R?= =?utf-8?B?bVJTL2JGZUtUdFVlbjlQMi8walBxUWVvRzIzVGdCT0hBNHBURGtqdlVOWDVB?= =?utf-8?B?aWV4ckdwSkFZQnE1dCtReGV6QS9vMkJ0cVluNTVNbU9UTVNuZjIwOEpmdW9z?= =?utf-8?B?VEFBMlZlanJDczRSTUhOVkdsc1AxM01UMWY0UjJtbGJvUW9qd0VIdDkyTVlN?= =?utf-8?B?NEtJK2FHRU43L0tzQjdPMzRTaW9wSk5kS1k2aEI4THE1aGNOM2syZHlVY1lp?= =?utf-8?B?RWM5THNDYTNXZjhGejZmbVo0YUVaZWs0R1VBaStSQWNKd1AzVldzZ0dTbUJS?= =?utf-8?B?NzBPS2lrTFloWHk0UG1jODlRcGlPUnMwMFJXVW0wVTh5aWNpSGgvUnRWRWc4?= =?utf-8?B?YjI5cU9xaGtRV04zWURac1VyQVVJUlhtdmEwV3NJdXBGUXlYVmRGaXFTQ0VV?= =?utf-8?B?eDAvNmgrbjdCYjAvM1QyR29RRk5KTUNlWWwwVklQSVBvUVlDekxoWUtHa3Fo?= =?utf-8?Q?OsDK9NnnmoCTcfQO9IJjGRbq77Fi+8=3D?= X-OriginatorOrg: os.amperecomputing.com X-MS-Exchange-CrossTenant-Network-Message-Id: 63223b2b-a7e6-4583-7619-08da07ea1c97 X-MS-Exchange-CrossTenant-AuthSource: SJ0PR01MB7282.prod.exchangelabs.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Mar 2022 07:45:32.3692 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 3bc2b170-fd94-476d-b0ce-4229bdc904a7 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: F62kzhaywn6eBDU5aMgP2qM4ZxNsHEaaLtYu1cMzxJXl1dm3+9qtDfjZuHM6XpV4n6m0tCj9eGrhhUpbAJz+6GzFK4sR25WjTxcHuqnEVhs= X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR01MB4283 X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,NICE_REPLY_A,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham 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 Added Dan as I have missed Dan's email address in the first place. My apologize, - Quan On 11/03/2022 13:58, Wolfram Sang wrote: > On Thu, Mar 10, 2022 at 06:41:18PM +0700, Quan Nguyen wrote: >> From: Dan Carpenter >> >> The copy_from_user() function returns the number of bytes remaining to >> be copied but we should return -EFAULT here. >> >> Fixes: 501c25b59508 ("ipmi: ssif_bmc: Add SSIF BMC driver") >> Signed-off-by: Dan Carpenter >> Signed-off-by: Corey Minyard >> Signed-off-by: Quan Nguyen > > It is nice that you want to keep this patch seperate to give Dan > credits, but I still think it should be merged into patch 1, so the > initial driver is as flawless as it can be. You could give Dan still > credits by mentioning him in the commit message IMO. Dan, would you be > fine with this? > >> v6: >> + New add in v6, thanks Dan for the patch [Dan] >> >> drivers/char/ipmi/ssif_bmc.c | 5 ++--- >> 1 file changed, 2 insertions(+), 3 deletions(-) >> >> diff --git a/drivers/char/ipmi/ssif_bmc.c b/drivers/char/ipmi/ssif_bmc.c >> index 62db97773654..91ac2cae756e 100644 >> --- a/drivers/char/ipmi/ssif_bmc.c >> +++ b/drivers/char/ipmi/ssif_bmc.c >> @@ -87,9 +87,8 @@ static ssize_t ssif_bmc_write(struct file *file, const char __user *buf, size_t >> if (count > sizeof(struct ssif_msg)) >> return -EINVAL; >> >> - ret = copy_from_user(&msg, buf, count); >> - if (ret) >> - return ret; >> + if (copy_from_user(&msg, buf, count)) >> + return -EFAULT; >> >> if (!msg.len || count < ssif_msg_len(&msg)) >> return -EINVAL; >> -- >> 2.35.1 >>