From patchwork Fri Mar 1 13:01:06 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ben Dooks X-Patchwork-Id: 10835283 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id C9F3F1515 for ; Fri, 1 Mar 2019 13:01:12 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id AA8692F6AA for ; Fri, 1 Mar 2019 13:01:12 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A8EA22F71D; Fri, 1 Mar 2019 13:01:12 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 183D22F6AA for ; Fri, 1 Mar 2019 13:01:12 +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 Sender: linux-fsdevel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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; }