Received: by 2002:a25:c593:0:0:0:0:0 with SMTP id v141csp386813ybe; Mon, 2 Sep 2019 03:17:12 -0700 (PDT) X-Google-Smtp-Source: APXvYqx9F1xgXSHqejU9kWbtP0ueR3wuTLXaCFoaCEyqoapQ6mKLoB+MkW+oRulc1+me3Tv86KjE X-Received: by 2002:a63:c70d:: with SMTP id n13mr24372363pgg.171.1567419432205; Mon, 02 Sep 2019 03:17:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1567419432; cv=none; d=google.com; s=arc-20160816; b=NhtbNeDYMPC89SytPwPCfs5W/cSSugJcBAs8sjtBBcdP4Igp0NctFef2MH94tGkXw5 E9+LAUray+XKKSi+YVN9lRYw3U67VuDUF3rPDk+GQfyKGcs8saC0huQ6Ofi38fObZYd4 KxiFld59ojeZ+BqO6mp1JLv1Fjs/dl5iffmpdH/8gswak9jnHMpL8prbQVTgdr1++h8a VgG2MuoX73jNfktqsnUVe9YIwhn+aKix+IcD51ca5LS6XCWu08Uhrvi6M28AZdv+I4gt 7pTFw6XEcFKv5XP3EG8R50JtafnAIg6G7ecPgeiPBd8lm3iU2pgjMVtndTmrApb/BXAG rm7g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-language :content-transfer-encoding:in-reply-to:mime-version:user-agent:date :message-id:organization:from:references:cc:to:subject :dkim-signature; bh=AfdOS5z9vEy8+ZDY2fpRv/BnQc3mYUEV45RXIeZtSJk=; b=b1ptkaB8wzvkxJg7Fk4jrb94BiDj/pcTx7xrXKy0AWYZnsBJydgev22vN1DC8KnI9T kZ7lmLHbMwPOgU80KXphUIuek/wLC742AWG/GmehkqXrKm7QbQKOrHNAeC74MUMqQfb0 IIuB6fvTdVnnNAEn6TWlnw31hlrqH6S+BG2+oKGJmUuTt1xemR1eTfeBnWit+JN42WLL wa6+VwLTzmhMeI08GDUBT5iP1GIUU8pJf7doxDK5pC67+9saA1vkgmqy6wZnfHee4C0P qVe7mg7voQnZ3eu10oz1PBPM0n6haAqejl8IL1/M9hyXtSLJgcbE0noyvEtbkr4MGVL9 ZcZg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2019-08-05 header.b=JvFPeW3z; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=oracle.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 33si2176457plf.111.2019.09.02.03.16.54; Mon, 02 Sep 2019 03:17:12 -0700 (PDT) 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=@oracle.com header.s=corp-2019-08-05 header.b=JvFPeW3z; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=oracle.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731256AbfIBJlE (ORCPT + 99 others); Mon, 2 Sep 2019 05:41:04 -0400 Received: from userp2120.oracle.com ([156.151.31.85]:39616 "EHLO userp2120.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729489AbfIBJlD (ORCPT ); Mon, 2 Sep 2019 05:41:03 -0400 Received: from pps.filterd (userp2120.oracle.com [127.0.0.1]) by userp2120.oracle.com (8.16.0.27/8.16.0.27) with SMTP id x829da8n125845; Mon, 2 Sep 2019 09:40:34 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=subject : to : cc : references : from : message-id : date : mime-version : in-reply-to : content-type : content-transfer-encoding; s=corp-2019-08-05; bh=AfdOS5z9vEy8+ZDY2fpRv/BnQc3mYUEV45RXIeZtSJk=; b=JvFPeW3zcoM8nqK6I0jf9k78GoBNImSYH9V7lPrtLaBMiHBJ4RqDtwyzrh0asUggWku4 q6g6fsD23jB7wG3P4BdyGLQUKpoig8bxYo5QjFfDM9Dds5TVdcrx3w5D5jEzlAR/e9CR ewUyYsDFIim+u1zS8S4eo/xb7Vc1kZ7du++0KDX8YE5LxMs5DZvl/3kb9xsz2IHtx96c H9hwfhwSvJBAIQTenxOJ8RCfKK5cG5dR/J5ASfHCHsYJv7phgCQT2gjK0FsGT21K3DZU ztz+SgptptLiKYx7ttKzq+iKXxf9+ncGtS0dmnALYKei/vtf0uzz+G8dz0zP4ljFZrgb bg== Received: from userp3020.oracle.com (userp3020.oracle.com [156.151.31.79]) by userp2120.oracle.com with ESMTP id 2us0myg04v-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 02 Sep 2019 09:40:34 +0000 Received: from pps.filterd (userp3020.oracle.com [127.0.0.1]) by userp3020.oracle.com (8.16.0.27/8.16.0.27) with SMTP id x829dMcs112363; Mon, 2 Sep 2019 09:40:34 GMT Received: from aserv0122.oracle.com (aserv0122.oracle.com [141.146.126.236]) by userp3020.oracle.com with ESMTP id 2uqg82xhs9-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 02 Sep 2019 09:40:33 +0000 Received: from abhmp0003.oracle.com (abhmp0003.oracle.com [141.146.116.9]) by aserv0122.oracle.com (8.14.4/8.14.4) with ESMTP id x829eWXs008355; Mon, 2 Sep 2019 09:40:32 GMT Received: from [10.191.10.186] (/10.191.10.186) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Mon, 02 Sep 2019 02:40:32 -0700 Subject: Re: [PATCH] x86/boot/compressed/64: Fix 'may be used uninitialized' issue To: Borislav Petkov Cc: linux-kernel@vger.kernel.org, "Kirill A. Shutemov" , Thomas Gleixner , Ingo Molnar , "H. Peter Anvin" , x86-ml References: <1567416624-26727-1-git-send-email-zhenzhong.duan@oracle.com> <20190902093534.GB9605@zn.tnic> From: Zhenzhong Duan Organization: Oracle Corporation Message-ID: <8361d582-3429-c91d-3f5a-0b988a0e16ed@oracle.com> Date: Mon, 2 Sep 2019 17:40:28 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:60.0) Gecko/20100101 Thunderbird/60.8.0 MIME-Version: 1.0 In-Reply-To: <20190902093534.GB9605@zn.tnic> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Content-Language: en-US X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9367 signatures=668685 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 malwarescore=0 phishscore=0 bulkscore=0 spamscore=0 mlxscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1906280000 definitions=main-1909020110 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9367 signatures=668685 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 priorityscore=1501 malwarescore=0 suspectscore=0 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 mlxscore=0 impostorscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1906280000 definitions=main-1909020110 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2019/9/2 17:35, Borislav Petkov wrote: > On Mon, Sep 02, 2019 at 05:30:24PM +0800, Zhenzhong Duan wrote: >> Builds kernel with "make bzImage EXTRA_CFLAGS=-Wall", gcc complains: >> >> arch/x86/boot/compressed/pgtable_64.c: In function 'paging_prepare': >> arch/x86/boot/compressed/pgtable_64.c:92:7: warning: 'new' may be used uninitialized in this function [-Wmaybe-uninitialized] >> new = round_down(new, PAGE_SIZE); >> >> In theory a random value of variable new may pass all the check and be >> assigned to bios_start, fixing it by assigning it an initial value. >> >> Fixes: 0a46fff2f910 ("x86/boot/compressed/64: Fix boot on machines with broken E820 table") >> Signed-off-by: Zhenzhong Duan >> Cc: Kirill A. Shutemov >> Cc: Thomas Gleixner >> Cc: Ingo Molnar >> Cc: Borislav Petkov >> Cc: "H. Peter Anvin" >> Cc: x86-ml >> --- >> arch/x86/boot/compressed/pgtable_64.c | 2 +- >> 1 file changed, 1 insertion(+), 1 deletion(-) >> >> diff --git a/arch/x86/boot/compressed/pgtable_64.c b/arch/x86/boot/compressed/pgtable_64.c >> index 2faddeb..c886269 100644 >> --- a/arch/x86/boot/compressed/pgtable_64.c >> +++ b/arch/x86/boot/compressed/pgtable_64.c >> @@ -72,7 +72,7 @@ static unsigned long find_trampoline_placement(void) >> >> /* Find the first usable memory region under bios_start. */ >> for (i = boot_params->e820_entries - 1; i >= 0; i--) { >> - unsigned long new; >> + unsigned long new = bios_start; >> >> entry = &boot_params->e820_table[i]; >> >> -- > https://git.kernel.org/tip/c96e8483cb2da6695c8b8d0896fe7ae272a07b54 > > In the future, use tip/master when preparing fixes because it has the > latest state of the x86 tree and you won't have to duplicate effort, > like in this case. Ok, I see. Thanks for your suggestion. Zhenzhong