From patchwork Fri May 19 01:37:10 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Su Hui X-Patchwork-Id: 1784126 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.ozlabs.org (client-ip=2404:9400:2:0:216:3eff:fee1:b9f1; helo=lists.ozlabs.org; envelope-from=linux-fsi-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org; receiver=) Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2404:9400:2:0:216:3eff:fee1:b9f1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4QPCMl69T1z20PS for ; Sun, 21 May 2023 17:46:59 +1000 (AEST) Received: from boromir.ozlabs.org (localhost [IPv6:::1]) by lists.ozlabs.org (Postfix) with ESMTP id 4QPCMl5M3kz3cXf for ; Sun, 21 May 2023 17:46:59 +1000 (AEST) X-Original-To: linux-fsi@lists.ozlabs.org Delivered-To: linux-fsi@lists.ozlabs.org Authentication-Results: lists.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nfschina.com (client-ip=42.101.60.195; helo=mail.nfschina.com; envelope-from=suhui@nfschina.com; receiver=) X-Greylist: delayed 123 seconds by postgrey-1.36 at boromir; Fri, 19 May 2023 11:39:35 AEST Received: from mail.nfschina.com (unknown [42.101.60.195]) by lists.ozlabs.org (Postfix) with SMTP id 4QMqJl1q9Dz3blx for ; Fri, 19 May 2023 11:39:34 +1000 (AEST) Received: from localhost.localdomain (unknown [180.167.10.98]) by mail.nfschina.com (Maildata Gateway V2.8.8) with ESMTPA id 2B0331801097CD; Fri, 19 May 2023 09:37:12 +0800 (CST) X-MD-Sfrom: suhui@nfschina.com X-MD-SrcIP: 180.167.10.98 From: Su Hui To: Jeremy Kerr , Joel Stanley , Alistar Popple , Eddie James Subject: [PATCH] drivers/fsi/scom: Return -EFAULT if copy fails Date: Fri, 19 May 2023 09:37:10 +0800 Message-Id: <20230519013710.34954-1-suhui@nfschina.com> X-Mailer: git-send-email 2.30.2 MIME-Version: 1.0 X-Mailman-Approved-At: Sun, 21 May 2023 17:46:46 +1000 X-BeenThere: linux-fsi@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Su Hui , eajames@us.ibm.com, kernel-janitors@vger.kernel.org, linux-kernel@vger.kernel.org, cbostic@linux.vnet.ibm.com, linux-fsi@lists.ozlabs.org Errors-To: linux-fsi-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "linux-fsi" The copy_to/from_user() functions return the number of bytes remaining to be copied, but we want to return -EFAULT to the user. Fixes: 680ca6dcf5c2 ("drivers/fsi: Add SCOM FSI client device driver") Signed-off-by: Su Hui --- drivers/fsi/fsi-scom.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/fsi/fsi-scom.c b/drivers/fsi/fsi-scom.c index bcb756dc9866..caaf7738eb98 100644 --- a/drivers/fsi/fsi-scom.c +++ b/drivers/fsi/fsi-scom.c @@ -335,7 +335,7 @@ static ssize_t scom_read(struct file *filep, char __user *buf, size_t len, if (rc) dev_dbg(dev, "copy to user failed:%d\n", rc); - return rc ? rc : len; + return rc ? -EFAULT : len; } static ssize_t scom_write(struct file *filep, const char __user *buf,