From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1038109AbdDUQlo (ORCPT ); Fri, 21 Apr 2017 12:41:44 -0400 Received: from mout.kundenserver.de ([212.227.126.135]:57142 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1037414AbdDUQl3 (ORCPT ); Fri, 21 Apr 2017 12:41:29 -0400 From: Arnd Bergmann To: Andrew Morton Cc: Arnd Bergmann , Alexander Viro , Michal Hocko , "Kirill A. Shutemov" , Lorenzo Stoakes , Ingo Molnar , linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: [PATCH] mm: gup: fix access_ok() argument type Date: Fri, 21 Apr 2017 18:26:32 +0200 Message-Id: <20170421162659.3314521-1-arnd@arndb.de> X-Mailer: git-send-email 2.9.0 X-Provags-ID: V03:K0:erlQmnFegRwaAZVyPoQDvqfXaKc/N6juQxFN698ZfGhhOz1wrJG zXRoZibtKHpdiXdy9/Cr2TuAAz65PxB7cANqzFziW5URgGFL/DNHkDLyj1f9zGFsDf9/2az FmbuPYnI92VeIc5UewoIUuOpuf59t7ayPLC9wWCqWA2AnNpyVnaHKGm2zQWd/OVc/8bS9uC iv3QZFD+/VUe0L9V3OGyA== X-UI-Out-Filterresults: notjunk:1;V01:K0:4KE4WYRocpM=:q16Q5+KGnHcQM9yCGa1YEE NfHI6KPDvsJiuRm3X/gqWVjvt2Ji+zsXL9FHWE5VrfOo9oJa+IymCGIF89JkSq2f1eqvoEU1y /X6I96XcNObzRJmKXyRaTSueqOzGSRC5/X01kFt+uvn7RoxFj2fNqFMMnYYWaUk0ndqzqTh0W OpsOYtQCz2O3pVhoCCKrrQtGnwTHxjIGAPkhd7qT/Cfk4WxkKE1xysz7zuVb5pJOZSGUycmz3 lzBTZPg/7WIxmnFqS0NQyLBOx7KagA/V29Rpta6i/PVT0aIWxZhbBNWpYPPPNhukoSaJo4tqp Ia01vO08BQimYdkpAzh+/5kYMS21Lgq0VqS0sZ0xyVLFn9R6BKzBqmqCaeHO5a+Z2eb5G9ZdS fUjPCYcMLESq8Jw7RKRPkKLWXfKSROAc9RGD9GNYgiphh2ciINGmY/PyRDM3Rj9Q/buDJZwbi 8dAoNYttjKhtlZwlQHvwtZF+72L61xdl8pMqVWrs6YNqvWaUQIL8O7Zd9/MWrcu0fh6kfkCZS kIMUTRLkG4FsU8TPSVnFR/ysaTukKL5euiHrkTkZVcy+3b8mIUsXz2c4sPbpc9HL26mEJHcaY IjS17HX99BwoaafnLdQI4QIRIHAWS6nL9RZwXcRoiJGKlyq7G/ZXTzSDSH17JQVnRAuKOBvHk NPFswO8qKFwjAoBjv4uWXStf9dBB9P2D2Gwi+XWSqRbB6hy/Z10IfIr810sgSg9cgQVI= Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org MIPS just got changed to only accept a pointer argument for access_ok(), causing one warning in drivers/scsi/pmcraid.c. I tried changing x86 the same way and found the same warning in __get_user_pages_fast() and nowhere else in the kernel during randconfig testing: mm/gup.c: In function '__get_user_pages_fast': mm/gup.c:1578:6: error: passing argument 1 of '__chk_range_not_ok' makes pointer from integer without a cast [-Werror=int-conversion] It would probably be a good idea to enforce type-safety in general, so let's change this file to not cause a warning if we do that. I don't know why the warning did not appear on MIPS. Fixes: 2667f50e8b81 ("mm: introduce a general RCU get_user_pages_fast()") Cc: Alexander Viro Signed-off-by: Arnd Bergmann --- mm/gup.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mm/gup.c b/mm/gup.c index 2559a3987de7..7f5bc26d9229 100644 --- a/mm/gup.c +++ b/mm/gup.c @@ -1575,7 +1575,7 @@ int __get_user_pages_fast(unsigned long start, int nr_pages, int write, end = start + len; if (unlikely(!access_ok(write ? VERIFY_WRITE : VERIFY_READ, - start, len))) + (void __user *)start, len))) return 0; /* -- 2.9.0 From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wr0-f197.google.com (mail-wr0-f197.google.com [209.85.128.197]) by kanga.kvack.org (Postfix) with ESMTP id BC7662806D2 for ; Fri, 21 Apr 2017 12:33:06 -0400 (EDT) Received: by mail-wr0-f197.google.com with SMTP id g67so5007227wrd.0 for ; Fri, 21 Apr 2017 09:33:06 -0700 (PDT) Received: from mout.kundenserver.de (mout.kundenserver.de. [212.227.126.131]) by mx.google.com with ESMTPS id o26si15190000wra.182.2017.04.21.09.33.04 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 21 Apr 2017 09:33:05 -0700 (PDT) From: Arnd Bergmann Subject: [PATCH] mm: gup: fix access_ok() argument type Date: Fri, 21 Apr 2017 18:26:32 +0200 Message-Id: <20170421162659.3314521-1-arnd@arndb.de> Sender: owner-linux-mm@kvack.org List-ID: To: Andrew Morton Cc: Arnd Bergmann , Alexander Viro , Michal Hocko , "Kirill A. Shutemov" , Lorenzo Stoakes , Ingo Molnar , linux-mm@kvack.org, linux-kernel@vger.kernel.org MIPS just got changed to only accept a pointer argument for access_ok(), causing one warning in drivers/scsi/pmcraid.c. I tried changing x86 the same way and found the same warning in __get_user_pages_fast() and nowhere else in the kernel during randconfig testing: mm/gup.c: In function '__get_user_pages_fast': mm/gup.c:1578:6: error: passing argument 1 of '__chk_range_not_ok' makes pointer from integer without a cast [-Werror=int-conversion] It would probably be a good idea to enforce type-safety in general, so let's change this file to not cause a warning if we do that. I don't know why the warning did not appear on MIPS. Fixes: 2667f50e8b81 ("mm: introduce a general RCU get_user_pages_fast()") Cc: Alexander Viro Signed-off-by: Arnd Bergmann --- mm/gup.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mm/gup.c b/mm/gup.c index 2559a3987de7..7f5bc26d9229 100644 --- a/mm/gup.c +++ b/mm/gup.c @@ -1575,7 +1575,7 @@ int __get_user_pages_fast(unsigned long start, int nr_pages, int write, end = start + len; if (unlikely(!access_ok(write ? VERIFY_WRITE : VERIFY_READ, - start, len))) + (void __user *)start, len))) return 0; /* -- 2.9.0 -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to majordomo@kvack.org. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: email@kvack.org