From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.0 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 29DDEC43381 for ; Fri, 1 Mar 2019 13:01:12 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id F1AA92084F for ; Fri, 1 Mar 2019 13:01:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728142AbfCANBL (ORCPT ); Fri, 1 Mar 2019 08:01:11 -0500 Received: from imap1.codethink.co.uk ([176.9.8.82]:56418 "EHLO imap1.codethink.co.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728017AbfCANBK (ORCPT ); Fri, 1 Mar 2019 08:01:10 -0500 Received: from [167.98.27.226] (helo=rainbowdash.codethink.co.uk) by imap1.codethink.co.uk with esmtpsa (Exim 4.84_2 #1 (Debian)) id 1gzhmm-0004d9-QY; Fri, 01 Mar 2019 13:01:08 +0000 Received: from ben by rainbowdash.codethink.co.uk with local (Exim 4.92-RC6) (envelope-from ) id 1gzhml-00015D-So; Fri, 01 Mar 2019 13:01:07 +0000 From: Ben Dooks To: linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.or Cc: Alexander Viro , linux-kernel@lists.codethink.co.uk, Ben Dooks Subject: [PATCH] exec: add __user case in get_user_arg_ptr() Date: Fri, 1 Mar 2019 13:01:06 +0000 Message-Id: <20190301130106.4121-1-ben.dooks@codethink.co.uk> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-fsdevel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org The get_user_arg_ptr() returns a __user annotated pointer but the ERR_PTR() returns do not have this annotation which triggers sparse warnings. Add a case to (char __user *) to fix the following: fs/exec.c:409:39: warning: incorrect type in return expression (different address spaces) fs/exec.c:409:39: expected char const [noderef] * fs/exec.c:409:39: got void * fs/exec.c:416:31: warning: incorrect type in return expression (different address spaces) fs/exec.c:416:31: expected char const [noderef] * fs/exec.c:416:31: got void * Signed-off-by: Ben Dooks --- fs/exec.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/fs/exec.c b/fs/exec.c index fb72d36f7823..19fa6f082db9 100644 --- a/fs/exec.c +++ b/fs/exec.c @@ -406,14 +406,14 @@ static const char __user *get_user_arg_ptr(struct user_arg_ptr argv, int nr) compat_uptr_t compat; if (get_user(compat, argv.ptr.compat + nr)) - return ERR_PTR(-EFAULT); + return (char __user *)ERR_PTR(-EFAULT); return compat_ptr(compat); } #endif if (get_user(native, argv.ptr.native + nr)) - return ERR_PTR(-EFAULT); + return (char __user *)ERR_PTR(-EFAULT); return native; } -- 2.20.1