Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp930000pxb; Wed, 3 Mar 2021 21:27:50 -0800 (PST) X-Google-Smtp-Source: ABdhPJwITUIZ6p4RfWctCOjUAXip5iZqXmJ/1MdVoqjuB6t13AxZW4dQs+Dy13/Rzg/cu6H13V+B X-Received: by 2002:aa7:d687:: with SMTP id d7mr2473812edr.118.1614835670068; Wed, 03 Mar 2021 21:27:50 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1614835670; cv=none; d=google.com; s=arc-20160816; b=u0m472HxJvfUhZicYDzRfcRJhSHv/8osr9sUbnxdf78Y8o9VhGxB5sofOMhqiWB6wg 4N+Tij6qqVMT+GDtVpxYar8wH5Wa11dvauvlkHmD3UUqt/Nt7LGccd7Yf1qH6ogd971u h2Yir0hA+ZjKwaTc4zosPTx598rlr/In+IeNwBjfWVQQN+Bgc6gJaNyK/TpNMI7oAbYh C8YKpEDvorMfgLC4OFRqgXnTGsLuwwf0ujPj0gh7rNBPWsM8sLYe/fKJ3aSqsBt86QHl 0mveBVncVp/mHZv/KVnj5/25F72YoqvXTEluB5flNZOJY2q/YVSwoS67Z2hk0h3AFDmT WHgA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:user-agent:references:message-id :in-reply-to:subject:cc:to:from:date; bh=gvr3hMazspDzYWgA0/gIlP9Iq5THXhGQySCw3q2NWOo=; b=zy3zKtKHWSdOIyoMs1n7OJdmWlmKXZtlPWZIi0MKBolFjIfKNYdkQfAN1U9ya4LWNM e9eaPnd2D5Qj7/Uwto6lAfNATXRomf+QsF4Ga5GqT9AWh+tSRoWshuCd+oCSCO1XS6fe cKVYjX/ZpjShJ9EnAFdR1bn5sEEkh8K2kcnQQgKyi+G3FhvMmBdlLl159oevs3jkEHXc XYdQsHVWMOSvM0ao+DYE3nbgwXHUFPd3UfGdhqtkwNyiaCRYv6siYwjxx36A15iX6tTA eBU/Yog+49b6S/qaSj8VONZ7A/ZPAkM9K7BC3pGrz7YlcvXmPMfpACnLtCS1N+9HA2Uq W34w== 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id fi16si5098848ejb.239.2021.03.03.21.27.27; Wed, 03 Mar 2021 21:27:50 -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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1575159AbhCBDxt (ORCPT + 99 others); Mon, 1 Mar 2021 22:53:49 -0500 Received: from angie.orcam.me.uk ([157.25.102.26]:37176 "EHLO angie.orcam.me.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241169AbhCAWCk (ORCPT ); Mon, 1 Mar 2021 17:02:40 -0500 Received: by angie.orcam.me.uk (Postfix, from userid 500) id 81D0992009C; Mon, 1 Mar 2021 23:01:49 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by angie.orcam.me.uk (Postfix) with ESMTP id 7B02892009B; Mon, 1 Mar 2021 23:01:49 +0100 (CET) Date: Mon, 1 Mar 2021 23:01:49 +0100 (CET) From: "Maciej W. Rozycki" To: Sergei Shtylyov cc: Wang Qing , Thomas Bogendoerfer , linux-mips@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] arch: mips: sibyte: Return -EFAULT if copy_to_user() fails In-Reply-To: <3a7d2007-b7d2-e428-406c-a6804bff6df0@gmail.com> Message-ID: References: <1614580437-19660-1-git-send-email-wangqing@vivo.com> <3a7d2007-b7d2-e428-406c-a6804bff6df0@gmail.com> User-Agent: Alpine 2.21 (DEB 202 2017-01-01) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, 1 Mar 2021, Sergei Shtylyov wrote: > > 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. > > Then 'err' is hardly a good name for that variable. :-) Something like `left' might be better, especially as it's the sole use. Also it's been like this from the beginning, so: Fixes: bb9b813bb665 ("[MIPS] Sibyte: Fix ZBbus profiler") or maybe: Fixes: d619f38fdacb ("[MIPS] Add bcm1480 ZBus trace support, fix wait related bugs") (since the file was renamed from a different name with the latter commit) would I think be helpful for backports too. It looks like potentially quite a nasty bug to me if someone actually uses this piece (I haven't). Maciej