Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp4477654ybv; Tue, 25 Feb 2020 21:09:09 -0800 (PST) X-Google-Smtp-Source: APXvYqwv1UgFRK+FwLaZQrN0HZUiChObeGLNNDB+SujlW2tRFU+xGYp/MX7x9RLcew+9mSWXixR4 X-Received: by 2002:aca:3f54:: with SMTP id m81mr1681070oia.73.1582693748916; Tue, 25 Feb 2020 21:09:08 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1582693748; cv=none; d=google.com; s=arc-20160816; b=GS/lVwPxOhzFFQwLiTkbtrZTHKijAmjXDgG3P5jX/fUhvxLvm1sJuONMVmPkGVDQUQ AF+Uafl47z/H5GSHtX6+zPTM2UNufp6rKGhXJqMidjLhfSrZ0iiDG1vsCICvnDdsbRX5 +LcC25twNhy7wtdCY1Hefsnjo88DQ8RacvDBk7mYrnnmtCkNKY+HcCR5F0sZGhornNiz /uoVVsR+4nDGBlY6b6Rerw3mL4bwv3y4oenmxPRJSBWTKeuL9JNwOeobLhQC8F1NfVsA 842nMX6XktnN/XYf+lWqrUoK0Z//teig0JDMLFyeudUfge1AXCcC4qRh0eJJm2AZsax0 UIvg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:dkim-signature; bh=P9F+TW11il3dDG/JQwLQZ9bfwJOcps3i7xL5sjC2o4k=; b=lmH5YHc9diHGJ1KbS+WUO/SnUx3QrcPkjfQOI8iy8Ku3O1T3W3R6bl5rT4xjhweY9r M7n7ZiNkNtlx/ZitAUm5Ov5EjHmhQ+z8wLR5pJ75BHO8euVx7BKMe8tvN0LMBgxmDJd0 BKRJrGffAkxY1L+nPWluLq5RwOo+Ey2S90Ac+/DXUqI3ZxOoFMZGI9BFNnuGUtqZf0MK RDldwvTF+BtmQKDNtpwp+yeR1X+6HS6xP5zS4Bix2h8uzrq5BPETa/nFAV6dc7069aLU PRLTAhJIbwkzPjICB+7oYDhXTkP46gcbNvGSvkOic5uDe/ykOE27jkNPYKGo9/clVuKt 7WwQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@c-s.fr header.s=mail header.b=KzpNUgHw; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id l17si644918otq.59.2020.02.25.21.08.56; Tue, 25 Feb 2020 21:09:08 -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=@c-s.fr header.s=mail header.b=KzpNUgHw; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726476AbgBZFIW (ORCPT + 99 others); Wed, 26 Feb 2020 00:08:22 -0500 Received: from pegase1.c-s.fr ([93.17.236.30]:11428 "EHLO pegase1.c-s.fr" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726287AbgBZFIW (ORCPT ); Wed, 26 Feb 2020 00:08:22 -0500 Received: from localhost (mailhub1-int [192.168.12.234]) by localhost (Postfix) with ESMTP id 48S3jJ1qKHz9tyKl; Wed, 26 Feb 2020 06:08:20 +0100 (CET) Authentication-Results: localhost; dkim=pass reason="1024-bit key; insecure key" header.d=c-s.fr header.i=@c-s.fr header.b=KzpNUgHw; dkim-adsp=pass; dkim-atps=neutral X-Virus-Scanned: Debian amavisd-new at c-s.fr Received: from pegase1.c-s.fr ([192.168.12.234]) by localhost (pegase1.c-s.fr [192.168.12.234]) (amavisd-new, port 10024) with ESMTP id umtjl2sVtDY2; Wed, 26 Feb 2020 06:08:20 +0100 (CET) Received: from messagerie.si.c-s.fr (messagerie.si.c-s.fr [192.168.25.192]) by pegase1.c-s.fr (Postfix) with ESMTP id 48S3jJ0LVHz9ty2Q; Wed, 26 Feb 2020 06:08:20 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=c-s.fr; s=mail; t=1582693700; bh=P9F+TW11il3dDG/JQwLQZ9bfwJOcps3i7xL5sjC2o4k=; h=Subject:To:Cc:References:From:Date:In-Reply-To:From; b=KzpNUgHw2EtMqKovHHARDbs08RAkwUm4n5Wu+3xK7obpFJoYeDpkkR2JrZaMBRac3 oDrO1U0t9a5ip9BQfSego2phz4FrMb9Aej7Oi8Bstz+rh+2re6Xrg1AHfwm0fomAkx p/P+J9gHqmSzukHZeTIOx2LnEQ/8Sd+bkMU6V4VU= Received: from localhost (localhost [127.0.0.1]) by messagerie.si.c-s.fr (Postfix) with ESMTP id C3E788B784; Wed, 26 Feb 2020 06:08:20 +0100 (CET) X-Virus-Scanned: amavisd-new at c-s.fr Received: from messagerie.si.c-s.fr ([127.0.0.1]) by localhost (messagerie.si.c-s.fr [127.0.0.1]) (amavisd-new, port 10023) with ESMTP id g_nrwaC9d962; Wed, 26 Feb 2020 06:08:20 +0100 (CET) Received: from [192.168.4.90] (unknown [192.168.4.90]) by messagerie.si.c-s.fr (Postfix) with ESMTP id E7E7D8B776; Wed, 26 Feb 2020 06:08:19 +0100 (CET) Subject: Re: [PATCH v3 3/6] powerpc/fsl_booke/64: implement KASLR for fsl_booke64 To: Jason Yan , mpe@ellerman.id.au, linuxppc-dev@lists.ozlabs.org, diana.craciun@nxp.com, benh@kernel.crashing.org, paulus@samba.org, npiggin@gmail.com, keescook@chromium.org, kernel-hardening@lists.openwall.com, oss@buserror.net Cc: linux-kernel@vger.kernel.org, zhaohongjiang@huawei.com References: <20200206025825.22934-1-yanaijie@huawei.com> <20200206025825.22934-4-yanaijie@huawei.com> <41b9f1ca-c6fd-291a-2c96-2a0e8a754ec4@c-s.fr> From: Christophe Leroy Message-ID: <046ebac6-9cab-cc3e-e535-9a50051dc25f@c-s.fr> Date: Wed, 26 Feb 2020 06:08:13 +0100 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:68.0) Gecko/20100101 Thunderbird/68.5.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: fr Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Le 26/02/2020 à 03:40, Jason Yan a écrit : > > > 在 2020/2/20 21:48, Christophe Leroy 写道: >> >> >> Le 06/02/2020 à 03:58, Jason Yan a écrit : >>>       /* >>>        * Decide which 64M we want to start >>>        * Only use the low 8 bits of the random seed >>>        */ >>> -    index = random & 0xFF; >>> +    unsigned long index = random & 0xFF; >> >> That's not good in terms of readability, index declaration should >> remain at the top of the function, should be possible if using >> IS_ENABLED() instead > > I'm wondering how to declare a variable inside a code block such as if > (IS_ENABLED(CONFIG_PPC32)) at the top of the function and use the > variable in another if (IS_ENABLED(CONFIG_PPC32)). Is there any good idea? You declare it outside the block as usual: unsigned long some_var; if (condition) { some_var = something; } do_many_things(); do_other_things(); if (condition) return some_var; else return 0; Christophe