Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755382AbbGUOGT (ORCPT ); Tue, 21 Jul 2015 10:06:19 -0400 Received: from mx1.redhat.com ([209.132.183.28]:39475 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754152AbbGUOGS (ORCPT ); Tue, 21 Jul 2015 10:06:18 -0400 Organization: Red Hat UK Ltd. Registered Address: Red Hat UK Ltd, Amberley Place, 107-111 Peascod Street, Windsor, Berkshire, SI4 1TE, United Kingdom. Registered in England and Wales under Company Registration No. 3798903 From: David Howells In-Reply-To: <1437459289-26553-1-git-send-email-ysato@users.sourceforge.jp> References: <1437459289-26553-1-git-send-email-ysato@users.sourceforge.jp> <1437023722-7432-1-git-send-email-ysato@users.sourceforge.jp> To: Yoshinori Sato Cc: dhowells@redhat.com, Arnd Bergmann , linux-arch@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v3] asm-generic: {get,put}_user ptr argument evaluate only 1 time MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <21798.1437487573.1@warthog.procyon.org.uk> Date: Tue, 21 Jul 2015 15:06:13 +0100 Message-ID: <21799.1437487573@warthog.procyon.org.uk> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 700 Lines: 24 Yoshinori Sato wrote: > #define get_user(x, ptr) \ > ({ \ > + uintptr_t __uip = (uintptr_t)(ptr); \ const? > might_fault(); \ > - access_ok(VERIFY_READ, ptr, sizeof(*ptr)) ? \ > - __get_user(x, ptr) : \ > + access_ok(VERIFY_READ, __uip, sizeof(*ptr)) ? \ > + __get_user((x), (__typeof__(*ptr) *)__uip) : \ > -EFAULT; \ > }) Would it be better to use void* instead of uintptr_t? David -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/