Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp3023528pxb; Sun, 28 Feb 2021 22:37:32 -0800 (PST) X-Google-Smtp-Source: ABdhPJzpT/kQXagJO8pYRILBx7V7ywMSmxk/5FMorjwzkObZvcpslfmEmkuDMZoVTyQANvg/Ow7G X-Received: by 2002:a05:6402:438a:: with SMTP id o10mr9564597edc.149.1614580651822; Sun, 28 Feb 2021 22:37:31 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1614580651; cv=none; d=google.com; s=arc-20160816; b=DH7ZAQQOmfiuhfz5A8SLwmeupAQRwljOjH/ltrsdin2XpfUVGEA4AQus9BmIZ74xA5 J2P8lL4car7MnDIcrD2qNG0G1hR4Ioa+qFzEO5LyHRofLpAFy1OB8xkjOnz38Q+2vUxO WQWeztMpsA1n/iYieFmzs6eWGutd5dYmpqf4Qs8PkdZUC3h5REalQbcC4UITiOc/6pDg TQYbgbgVAJRqL8Frrbg0Ss3YQdLb80Sz6+NYZ9auv6yZhLFDHlyJtaWko2bay8Pz26Ev qgRVI5YiXWBzYq4XzxUeBwGe+2LGuocoaVQLqWQ3e+/DFmBd+l9ix7OQ7GE6irQZxhd2 G+2g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:message-id:date:subject:to:from; bh=a6YCEl85x2sPHyJMPJYbFZS4iEqSnLLfFd/4ojLx2uk=; b=nm+gwLEP3yhRKtayH7F4oQ+1OloUgHUvz2WZpwChyd0Z+Ko7jLrkoSWjqEVYozx8i1 u8IE6wAbNAK26OGW9nABM8Qx0WSUWQaqZbuOzt3eVQLfFFTCWaPXx92qtfBTDPIHCxlf 07lBP8m0Xoq38p1Ln5+RxDoW0mPUT5v6B9Q4M1uJTn22ob1T9b1T4FPaJPbKrp0JEU3O pwwOTzjUh5bg8lhK12eVKWlYj+tOw4qka18ZQsNJhnxbU0tkcMoW0DoQyaLJ6n4AjswS z8iyTatQnYr3Dr/ayb5Uw6qawxgqxsarsQW3gPUuo3rKNdkSHTMWtsADEvWV0LtEi4lB 82Lw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=vivo.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id t19si3447597ejx.42.2021.02.28.22.37.09; Sun, 28 Feb 2021 22:37:31 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=vivo.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231926AbhCAGfC (ORCPT + 99 others); Mon, 1 Mar 2021 01:35:02 -0500 Received: from mail-m121143.qiye.163.com ([115.236.121.143]:42452 "EHLO mail-m121143.qiye.163.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229455AbhCAGfB (ORCPT ); Mon, 1 Mar 2021 01:35:01 -0500 Received: from vivo-HP-ProDesk-680-G4-PCI-MT.vivo.xyz (unknown [58.251.74.231]) by mail-m121143.qiye.163.com (Hmail) with ESMTPA id 54C0E5401F7; Mon, 1 Mar 2021 14:34:14 +0800 (CST) From: Wang Qing To: Thomas Bogendoerfer , Wang Qing , linux-mips@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] arch: mips: sibyte: Return -EFAULT if copy_to_user() fails Date: Mon, 1 Mar 2021 14:33:56 +0800 Message-Id: <1614580437-19660-1-git-send-email-wangqing@vivo.com> X-Mailer: git-send-email 2.7.4 X-HM-Spam-Status: e1kfGhgUHx5ZQUtXWQgYFAkeWUFZS1VLWVdZKFlBSE83V1ktWUFJV1kPCR oVCBIfWUFZSx9NTkkfTUNNHhlPVkpNSk9OQ0tPTk9OTUJVEwETFhoSFyQUDg9ZV1kWGg8SFR0UWU FZT0tIVUpKS0hNSlVLWQY+ X-HM-Sender-Digest: e1kMHhlZQR0aFwgeV1kSHx4VD1lBWUc6MjI6ORw*Ej8LHxAOFiofOjhP T0kKCy9VSlVKTUpPTkNLT05PQk9NVTMWGhIXVQwaFRwKEhUcOw0SDRRVGBQWRVlXWRILWUFZTkNV SU5KVUxPVUlISllXWQgBWUFKTkhMNwY+ X-HM-Tid: 0a77ec7e9452b038kuuu54c0e5401f7 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The copy_to_user() function returns the number of bytes remaining to be copied, but we want to return -EFAULT if the copy doesn't complete. Signed-off-by: Wang Qing --- arch/mips/sibyte/common/sb_tbprof.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/mips/sibyte/common/sb_tbprof.c b/arch/mips/sibyte/common/sb_tbprof.c index f80d7a7..eac125f --- a/arch/mips/sibyte/common/sb_tbprof.c +++ b/arch/mips/sibyte/common/sb_tbprof.c @@ -465,7 +465,7 @@ static ssize_t sbprof_tb_read(struct file *filp, char *buf, if (err) { *offp = cur_off + cur_count - err; mutex_unlock(&sbp.lock); - return err; + return -EFAULT; } pr_debug(DEVNAME ": read from sample %d, %d bytes\n", cur_sample, cur_count); -- 2.7.4