Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp10108imm; Fri, 25 May 2018 14:55:24 -0700 (PDT) X-Google-Smtp-Source: AB8JxZpThtiawQRizNf66vwSUS5eBXb5TU+NtlxIZvCckezcnJI6bgadfd+Yf8Obj5BvLIROUOHA X-Received: by 2002:a17:902:507:: with SMTP id 7-v6mr4278396plf.259.1527285324533; Fri, 25 May 2018 14:55:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527285324; cv=none; d=google.com; s=arc-20160816; b=B6zzKxA6/SDPb1rlcygm40ee4p9oRfMHNObXxC9iOo6n6FD24TpxYmBdd0L+Bgw7YJ vlOet+EL9YBOxqLob2QHRUTBUxVKoVpU3XiwUsUG3CDW5LD3LPhxUunByDtj0tEE4tzq opfzBYBmoJTWrZxjNEd7E5J2l6gZNpvuupp9jJHl19AidFafLYnz2yda/TE/WKwyxSPw iT5RNbJ9H0VG8S2QOrK1rT+UYIjgnjMGE4byeEuIYctyhTNpMUK82pUxfQ2wZ4zk5D/I owbtoWu1FU6vmjlmwhtwVnqwJ6+UbTczxVPGcMzpxD7YzV0fcmg+PrJD7fMfKvzA6Z4I q2fg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:content-transfer-encoding :content-id:spamdiagnosticmetadata:spamdiagnosticoutput :content-language:accept-language:in-reply-to:references:message-id :date:thread-index:thread-topic:subject:cc:to:from:dkim-signature :dkim-signature:arc-authentication-results; bh=+V4duTpbqXiYYfMh9e8OP0MvmOKpb/CL3NmmKRZdzOY=; b=gY2io/3Aaqr/EvlCta8MfPJ7Vur+kPrQ4vkNmsIgmMnnR7hMhLoq93BgebavdJXPB+ WC2PmNIGDpgbhJ+HwnSJHbBXJN1hxLtbdn2H/PWkLoTgvbbHu35WjtcDRi3G5mgYmgxS 2rflV76k5DtZdBJIuUS4l35W6T1JMh+leZmk6xPQ06JZ5Ufkm88iSEm3nSSWR7oAuccq R39DCNCY43RtMUhMU/WZjPCWUD9K82NBO/lP2w6Br8KCiSDPXvS7Q+vwt/tHZRjBDjnS JawdXqdYaYn3kZDpmriMDqjmjtNEj6rp5tHFbYyYL3Mp8OuCzb1hmbXQnCTMCujqr4+n 0E1A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@fb.com header.s=facebook header.b=h7KFj57q; dkim=pass header.i=@fb.onmicrosoft.com header.s=selector1-fb-com header.b=EMSta9QB; 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=fb.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id l10-v6si6747030pgf.354.2018.05.25.14.55.09; Fri, 25 May 2018 14:55:24 -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=@fb.com header.s=facebook header.b=h7KFj57q; dkim=pass header.i=@fb.onmicrosoft.com header.s=selector1-fb-com header.b=EMSta9QB; 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=fb.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1030613AbeEYVyj (ORCPT + 99 others); Fri, 25 May 2018 17:54:39 -0400 Received: from mx0b-00082601.pphosted.com ([67.231.153.30]:48890 "EHLO mx0a-00082601.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1030394AbeEYVyh (ORCPT ); Fri, 25 May 2018 17:54:37 -0400 Received: from pps.filterd (m0001255.ppops.net [127.0.0.1]) by mx0b-00082601.pphosted.com (8.16.0.22/8.16.0.22) with SMTP id w4PLqNbH001123; Fri, 25 May 2018 14:54:09 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=fb.com; h=from : to : cc : subject : date : message-id : references : in-reply-to : content-type : content-id : content-transfer-encoding : mime-version; s=facebook; bh=+V4duTpbqXiYYfMh9e8OP0MvmOKpb/CL3NmmKRZdzOY=; b=h7KFj57qx32Y3alJtGpEfvIlfciJegM2HNS4DvDHuu8fZSltLdKOcodgmdPI+1bP5vE2 QLIUlJbkPuTjxbmYQ9Up+9W5PfUhSem718SntFRBIkkkNPQHDZ1QNO6bkQw2vcwhtQVp 3KyHgM5aLLNmg4kI+W5i1EMbFFY87pZysAQ= Received: from maileast.thefacebook.com ([199.201.65.23]) by mx0b-00082601.pphosted.com with ESMTP id 2j6jnchgak-1 (version=TLSv1 cipher=ECDHE-RSA-AES256-SHA bits=256 verify=NOT); Fri, 25 May 2018 14:54:09 -0700 Received: from NAM01-BN3-obe.outbound.protection.outlook.com (192.168.183.28) by o365-in.thefacebook.com (192.168.177.29) with Microsoft SMTP Server (TLS) id 14.3.361.1; Fri, 25 May 2018 17:54:07 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=fb.onmicrosoft.com; s=selector1-fb-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=+V4duTpbqXiYYfMh9e8OP0MvmOKpb/CL3NmmKRZdzOY=; b=EMSta9QBccyPI3MMUowyNzmXMOs0K+NWRO7cZE+3S6yRO05kofZkYbkz1LVQQ8YuKmJaAPcagYcxJZGj8QTsTVdLfcsXjwe1PdgUyTvqaNKkBVi9HuMJVnR7iZ2gwTkIHWRQlWLnesnn93cDDAaf3N71QhWT+qNAL3IV8pI2sxM= Received: from MWHPR15MB1165.namprd15.prod.outlook.com (10.175.2.19) by MWHPR15MB1421.namprd15.prod.outlook.com (10.173.234.135) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.797.11; Fri, 25 May 2018 21:54:05 +0000 Received: from MWHPR15MB1165.namprd15.prod.outlook.com ([fe80::9485:7727:4b71:8cc0]) by MWHPR15MB1165.namprd15.prod.outlook.com ([fe80::9485:7727:4b71:8cc0%14]) with mapi id 15.20.0797.011; Fri, 25 May 2018 21:54:04 +0000 From: Song Liu To: Arnd Bergmann CC: Alexei Starovoitov , Daniel Borkmann , Yonghong Song , "David S. Miller" , Martin Lau , Chenbo Feng , Jakub Kicinski , "netdev@vger.kernel.org" , "linux-kernel@vger.kernel.org" Subject: Re: [PATCH, net-next 2/2] bpf: avoid -Wmaybe-uninitialized warning Thread-Topic: [PATCH, net-next 2/2] bpf: avoid -Wmaybe-uninitialized warning Thread-Index: AQHT9HAwmV7gBmqT/UaT5SYlaUzmvaRA/OmA Date: Fri, 25 May 2018 21:54:04 +0000 Message-ID: <1E0F5F01-EB03-4717-95E4-41944690B3E9@fb.com> References: <20180525213331.2115471-1-arnd@arndb.de> <20180525213331.2115471-2-arnd@arndb.de> In-Reply-To: <20180525213331.2115471-2-arnd@arndb.de> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-mailer: Apple Mail (2.3445.6.18) x-originating-ip: [2620:10d:c090:200::7:1409] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1;MWHPR15MB1421;7:F8U72FIEFAj0Ui4xAx8MyMFocCIUVfRV2KRDV/WfK9MWew2NkQn6KJSP7RwJzKnmtL74lzmVdH+ljoH+blSk8hJAtcFCXwS27O6lRPj4CMJH99P+lH3LXFnQqilpm45HBPDytOvoTyxzUn6rN7gv8HikL8yWgW9Wr33Ig/WgKOZL4LQugKwyj42/3jZGfli7drY0Nh3gHthekN6W1ihSuSA99t+Mio+hLh412npPUrYek9Fn9FVa4/cjRQJ+DG25;20:TLvw9gucronWWTLwOabbs2QLE2vSRBRqibbuhdg6wByXQLRkcCyO3Mkq9nU3aflmEXqEBSeXmNTQyQ6lY77BGZZqNuCTF+KBw/7ndaze5IEYqN0vQQ77GdSjdWlY/Gk6u7sEg08VAuBS4ocAi+liMVMyVIVqAT+hAhzNIJkhQvY= x-ms-exchange-antispam-srfa-diagnostics: SOS;SOR; x-forefront-antispam-report: SFV:SKI;SCL:-1;SFV:NSPM;SFS:(10019020)(346002)(376002)(39860400002)(396003)(39380400002)(366004)(199004)(189003)(478600001)(57306001)(14454004)(105586002)(97736004)(83716003)(7736002)(2900100001)(575784001)(305945005)(86362001)(46003)(36756003)(446003)(8936002)(5250100002)(3660700001)(3280700002)(50226002)(8676002)(81166006)(81156014)(486006)(6116002)(11346002)(476003)(2616005)(59450400001)(76176011)(186003)(99286004)(316002)(54906003)(102836004)(53546011)(6506007)(6916009)(2906002)(68736007)(82746002)(5660300001)(229853002)(33656002)(4326008)(25786009)(106356001)(6246003)(53936002)(6512007)(6486002)(39060400002)(6436002);DIR:OUT;SFP:1102;SCL:1;SRVR:MWHPR15MB1421;H:MWHPR15MB1165.namprd15.prod.outlook.com;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;A:1;MX:1; x-microsoft-antispam: UriScan:;BCL:0;PCL:0;RULEID:(7020095)(4652020)(5600026)(4534165)(4627221)(201703031133081)(201702281549075)(2017052603328)(7153060)(7193020);SRVR:MWHPR15MB1421; x-ms-traffictypediagnostic: MWHPR15MB1421: x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:(67672495146484); x-ms-exchange-senderadcheck: 1 x-exchange-antispam-report-cfa-test: BCL:0;PCL:0;RULEID:(8211001083)(6040522)(2401047)(5005006)(8121501046)(3002001)(10201501046)(3231254)(11241501184)(944501410)(52105095)(93006095)(93001095)(149027)(150027)(6041310)(20161123560045)(20161123562045)(20161123558120)(20161123564045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(6072148)(201708071742011)(7699016);SRVR:MWHPR15MB1421;BCL:0;PCL:0;RULEID:;SRVR:MWHPR15MB1421; x-forefront-prvs: 06833C6A67 received-spf: None (protection.outlook.com: fb.com does not designate permitted sender hosts) x-microsoft-antispam-message-info: qnDGcZwG+rYysNSZaYRYCz4jboV5PQMi3ked7mlgioHyTAYP4LaEhsbWMmvWI45A2udkrMG8mwcK10TGcReos6efLKk+xaYJdkEoxnUTClx9Mcn5/nhD4vO6lDOwpRogp5fayRn3n/6cq0M6knWTVB0eBbXq7DJy4rk5oiDPFOvp1l7SyYcIv1K2mDIB+nsE spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM Content-Type: text/plain; charset="us-ascii" Content-ID: Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-MS-Office365-Filtering-Correlation-Id: a52f191a-510b-4c66-07ba-08d5c28a08a0 X-MS-Exchange-CrossTenant-Network-Message-Id: a52f191a-510b-4c66-07ba-08d5c28a08a0 X-MS-Exchange-CrossTenant-originalarrivaltime: 25 May 2018 21:54:04.6899 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 8ae927fe-1255-47a7-a2af-5f3a069daaa2 X-MS-Exchange-Transport-CrossTenantHeadersStamped: MWHPR15MB1421 X-OriginatorOrg: fb.com X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:,, definitions=2018-05-25_08:,, signatures=0 X-Proofpoint-Spam-Reason: safe X-FB-Internal: Safe Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org > On May 25, 2018, at 2:33 PM, Arnd Bergmann wrote: >=20 > The stack_map_get_build_id_offset() function is too long for gcc to track > whether 'work' may or may not be initialized at the end of it, leading > to a false-positive warning: >=20 > kernel/bpf/stackmap.c: In function 'stack_map_get_build_id_offset': > kernel/bpf/stackmap.c:334:13: error: 'work' may be used uninitialized in = this function [-Werror=3Dmaybe-uninitialized] >=20 > This removes the 'in_nmi_ctx' flag and uses the state of that variable > itself to see if it got initialized. >=20 > Fixes: bae77c5eb5b2 ("bpf: enable stackmap with build_id in nmi context") > Signed-off-by: Arnd Bergmann > --- > kernel/bpf/stackmap.c | 7 +++---- > 1 file changed, 3 insertions(+), 4 deletions(-) >=20 > diff --git a/kernel/bpf/stackmap.c b/kernel/bpf/stackmap.c > index b59ace0f0f09..b675a3f3d141 100644 > --- a/kernel/bpf/stackmap.c > +++ b/kernel/bpf/stackmap.c > @@ -285,11 +285,10 @@ static void stack_map_get_build_id_offset(struct bp= f_stack_build_id *id_offs, > { > int i; > struct vm_area_struct *vma; > - bool in_nmi_ctx =3D in_nmi(); > bool irq_work_busy =3D false; > - struct stack_map_irq_work *work; > + struct stack_map_irq_work *work =3D NULL; >=20 > - if (in_nmi_ctx) { > + if (in_nmi()) { > work =3D this_cpu_ptr(&up_read_work); > if (work->irq_work.flags & IRQ_WORK_BUSY) > /* cannot queue more up_read, fallback */ > @@ -328,7 +327,7 @@ static void stack_map_get_build_id_offset(struct bpf_= stack_build_id *id_offs, > id_offs[i].status =3D BPF_STACK_BUILD_ID_VALID; > } >=20 > - if (!in_nmi_ctx) { > + if (!work) { > up_read(¤t->mm->mmap_sem); > } else { > work->sem =3D ¤t->mm->mmap_sem; > --=20 > 2.9.0 >=20 Acked-by: Song Liu =