From patchwork Fri Feb 17 16:52:29 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephen Boyd X-Patchwork-Id: 94166 Delivered-To: patch@linaro.org Received: by 10.140.20.99 with SMTP id 90csp256644qgi; Fri, 17 Feb 2017 08:52:41 -0800 (PST) X-Received: by 10.84.162.204 with SMTP id o12mr12677248plg.132.1487350361870; Fri, 17 Feb 2017 08:52:41 -0800 (PST) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id j85si10797749pfk.49.2017.02.17.08.52.41; Fri, 17 Feb 2017 08:52:41 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934613AbdBQQwf (ORCPT + 25 others); Fri, 17 Feb 2017 11:52:35 -0500 Received: from mail-pg0-f51.google.com ([74.125.83.51]:36225 "EHLO mail-pg0-f51.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S934140AbdBQQwb (ORCPT ); Fri, 17 Feb 2017 11:52:31 -0500 Received: by mail-pg0-f51.google.com with SMTP id v184so16897387pgv.3 for ; Fri, 17 Feb 2017 08:52:31 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id; bh=dPfToniSe5G35pY3zWpT0A2k9NvZl3SatoW85OplyJc=; b=EQTXUk7k0spyKb4lO3VRxSx8JF2ip/VfewrbEtlNvay+1iLWvxtrINDBywlF4dC49c GnDq1mhaua/aXUUZHwDew/aHA2DLjS+Zpr5Z8Aqd0sKI/IxEi332NUnsoLSGA3wc+tSf vxuzNgAyZa7UnEU7I4f26FZVeuMYzeTPkpUXo= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=dPfToniSe5G35pY3zWpT0A2k9NvZl3SatoW85OplyJc=; b=Coz/yOkaSOYz/wARUWXcKtV3WV8TH69qRglCgIqj36NTXagUmRqK59mHM3Orjzat3d K18uEp/L7BZ3mPsDaKpM4y4KOAsuAkFqgYl77d2dHkoVUkfw6WposeblSuahXD4pIB5/ cX02kA+lK8h31zri0raPir1721+3LrXUC+sUqdhxN3bQQVh42W+UychCc0q3Tu50A4xc qaf2Mwwk7OOqom9O7urO3fwPG/bLMK51Pv1r0SZuSy3YrjXxbc4023dW8pDzSSbACXvr B5sARUUtsvn/vNlRe/0ssZlPdGIALALne9PYj1p60W0f/M6cdaQ2mSaO4OfV2pjj7drR TgYQ== X-Gm-Message-State: AMke39mjmqV1JoZJawrsSiTmfeRTO71ueuVgZh1NEkx29xmpUtOvr30fldgeECod/yroSix+ X-Received: by 10.98.66.82 with SMTP id p79mr10635027pfa.10.1487350351050; Fri, 17 Feb 2017 08:52:31 -0800 (PST) Received: from localhost.localdomain (i-global254.qualcomm.com. [199.106.103.254]) by smtp.gmail.com with ESMTPSA id 19sm20625414pfj.107.2017.02.17.08.52.30 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 17 Feb 2017 08:52:30 -0800 (PST) From: Stephen Boyd To: Arnd Bergmann Cc: linux-kernel@vger.kernel.org, linux-arch@vger.kernel.org Subject: [PATCH] asm-generic: Force cast get_user() setting x to 0 Date: Fri, 17 Feb 2017 08:52:29 -0800 Message-Id: <20170217165229.17768-1-stephen.boyd@linaro.org> X-Mailer: git-send-email 2.10.0.297.gf6727b0 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org If we call get_user() with an __le* or __be* type sparse will complain when we assign the result to 0 on the faulting path. Let's force cast here so that sparse doesn't complain. This mirrors what we do in __get_user() as well. Signed-off-by: Stephen Boyd --- I made a similar fix to arm64 headers, and it looks like asm-generic would need the same fix. include/asm-generic/uaccess.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- 2.10.0.297.gf6727b0 diff --git a/include/asm-generic/uaccess.h b/include/asm-generic/uaccess.h index cc6bb319e464..6352d61df7eb 100644 --- a/include/asm-generic/uaccess.h +++ b/include/asm-generic/uaccess.h @@ -227,7 +227,7 @@ extern int __put_user_bad(void) __attribute__((noreturn)); might_fault(); \ access_ok(VERIFY_READ, __p, sizeof(*ptr)) ? \ __get_user((x), (__typeof__(*(ptr)) *)__p) : \ - ((x) = (__typeof__(*(ptr)))0,-EFAULT); \ + ((x) = (__force __typeof__(*(ptr)))0, -EFAULT); \ }) #ifndef __get_user_fn