From patchwork Tue Mar 22 21:45:35 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Morton X-Patchwork-Id: 12789223 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7FFA6C43219 for ; Tue, 22 Mar 2022 21:45:38 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 143EF6B013A; Tue, 22 Mar 2022 17:45:38 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 055576B013B; Tue, 22 Mar 2022 17:45:38 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id E0FE96B013C; Tue, 22 Mar 2022 17:45:37 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (relay.hostedemail.com [64.99.140.26]) by kanga.kvack.org (Postfix) with ESMTP id CC1FE6B013A for ; Tue, 22 Mar 2022 17:45:37 -0400 (EDT) Received: from smtpin08.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id 9BBDD23FE6 for ; Tue, 22 Mar 2022 21:45:37 +0000 (UTC) X-FDA: 79273354314.08.16879F8 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by imf19.hostedemail.com (Postfix) with ESMTP id 2875B1A0036 for ; Tue, 22 Mar 2022 21:45:37 +0000 (UTC) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 991166104C; Tue, 22 Mar 2022 21:45:36 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id EFA3DC340EC; Tue, 22 Mar 2022 21:45:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linux-foundation.org; s=korg; t=1647985536; bh=koN+O93h9DoI06AbB3NNqvHiV3pa1CEpORDqQtz7MlY=; h=Date:To:From:In-Reply-To:Subject:From; b=mmRClisvqLONimhzS6Jl8prC2DOaOWqTd/7U/ZY1/iHvTSRhouVWoEcnHUduH7GRO Mtrgyql6QXsB+uZAy/i2zRR+w8Lyn8Za5EXd5roaBrzLzlY+bwxbAfylVCRhAj8XAv c4q3/A98BRJW2feZMgcuBeYRETxNJCXKdENTNwjM= Date: Tue, 22 Mar 2022 14:45:35 -0700 To: shuah@kernel.org,guozhengkui@vivo.com,akpm@linux-foundation.org,patches@lists.linux.dev,linux-mm@kvack.org,mm-commits@vger.kernel.org,torvalds@linux-foundation.org,akpm@linux-foundation.org From: Andrew Morton In-Reply-To: <20220322143803.04a5e59a07e48284f196a2f9@linux-foundation.org> Subject: [patch 139/227] userfaultfd/selftests: fix uninitialized_var.cocci warning Message-Id: <20220322214535.EFA3DC340EC@smtp.kernel.org> Authentication-Results: imf19.hostedemail.com; dkim=pass header.d=linux-foundation.org header.s=korg header.b=mmRClisv; spf=pass (imf19.hostedemail.com: domain of akpm@linux-foundation.org designates 139.178.84.217 as permitted sender) smtp.mailfrom=akpm@linux-foundation.org; dmarc=none X-Rspam-User: X-Rspamd-Server: rspam10 X-Rspamd-Queue-Id: 2875B1A0036 X-Stat-Signature: dfu35119a5tthm33g5w6rn3g4e1nb9t1 X-HE-Tag: 1647985536-222366 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: From: Guo Zhengkui Subject: userfaultfd/selftests: fix uninitialized_var.cocci warning Fix following coccicheck warning: tools/testing/selftests/vm/userfaultfd.c:556:23-24: WARNING this kind of initialization is deprecated `unsigned long page_nr = *(&page_nr)` has the same form of uninitialized_var() macro. I remove the redundant assignement. It has been tested with gcc (Debian 8.3.0-6) 8.3.0. The patch which removed uninitialized_var() is: https://lore.kernel.org/all/20121028102007.GA7547@gmail.com/ And there is very few "/* GCC */" comments in the Linux kernel code now. Link: https://lkml.kernel.org/r/20220304082333.9252-1-guozhengkui@vivo.com Signed-off-by: Guo Zhengkui Cc: Shuah Khan Signed-off-by: Andrew Morton --- tools/testing/selftests/vm/userfaultfd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/tools/testing/selftests/vm/userfaultfd.c~userfaultfd-selftests-fix-uninitialized_varcocci-warning +++ a/tools/testing/selftests/vm/userfaultfd.c @@ -540,7 +540,7 @@ static void continue_range(int ufd, __u6 static void *locking_thread(void *arg) { unsigned long cpu = (unsigned long) arg; - unsigned long page_nr = *(&(page_nr)); /* uninitialized warning */ + unsigned long page_nr; unsigned long long count; if (!(bounces & BOUNCE_RANDOM)) {