From patchwork Wed Oct 28 12:21:02 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lukas Bulwahn X-Patchwork-Id: 11862713 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id C0A4461C for ; Wed, 28 Oct 2020 12:21:26 +0000 (UTC) Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 11C342470A for ; Wed, 28 Oct 2020 12:21:25 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=lists.elisa.tech header.i=@lists.elisa.tech header.b="OCVADcWW" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 11C342470A Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=bounce+72012+128+4688437+8417402@lists.elisa.tech X-Received: by 127.0.0.2 with SMTP id fg6WYY4689772x6soAigZXDS; Wed, 28 Oct 2020 05:21:24 -0700 X-Received: from mail-wm1-f68.google.com (mail-wm1-f68.google.com [209.85.128.68]) by mx.groups.io with SMTP id smtpd.web09.7938.1603887684349177386 for ; Wed, 28 Oct 2020 05:21:24 -0700 X-Received: by mail-wm1-f68.google.com with SMTP id l8so2897268wmg.3 for ; Wed, 28 Oct 2020 05:21:24 -0700 (PDT) X-Gm-Message-State: P1V57uHvkBZoKogJiXJvzyL5x4688437AA= X-Google-Smtp-Source: ABdhPJyaRHfb5LCfX2Rq7KACTz6umOsO5aK3fujyrp10owGv38bNI8BTsGvajv1jEuk9xmUB2K/Xsg== X-Received: by 2002:a1c:bdc4:: with SMTP id n187mr8303423wmf.185.1603887682784; Wed, 28 Oct 2020 05:21:22 -0700 (PDT) X-Received: from felia.fritz.box ([2001:16b8:2d7a:200:a915:6596:e9b0:4f60]) by smtp.gmail.com with ESMTPSA id c1sm6783945wru.49.2020.10.28.05.21.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 28 Oct 2020 05:21:22 -0700 (PDT) From: "Lukas Bulwahn" To: Thomas Gleixner , Ingo Molnar , Borislav Petkov , Josh Poimboeuf , x86@kernel.org Cc: "H . Peter Anvin" , Peter Zijlstra , Nathan Chancellor , Nick Desaulniers , linux-kernel@vger.kernel.org, clang-built-linux@googlegroups.com, kernel-janitors@vger.kernel.org, linux-safety@lists.elisa.tech, Lukas Bulwahn Subject: [linux-safety] [PATCH] x86/unwind: remove unneeded initialization Date: Wed, 28 Oct 2020 13:21:02 +0100 Message-Id: <20201028122102.24202-1-lukas.bulwahn@gmail.com> Precedence: Bulk List-Unsubscribe: Sender: linux-safety@lists.elisa.tech List-Id: Mailing-List: list linux-safety@lists.elisa.tech; contact linux-safety+owner@lists.elisa.tech Delivered-To: mailing list linux-safety@lists.elisa.tech List-Post: DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=lists.elisa.tech; q=dns/txt; s=20140610; t=1603887684; bh=MhQFjhZs0NlFxe6wM/FH/2h8N+FcP6P4lLQputpcg90=; h=Cc:Date:From:Subject:To; b=OCVADcWWKrFwe7myXgh3VdmLMOcuKBXtrhC1Ai//udwks86Cu+SvIiXTgKJiag6AjA2 s/4bueL54ka8cykKw+ipPRZjQhCmatRG4fOYjeDKqOU+MmijGk4M49fQM+g0woRJCxXwA nwpKUBig9Jjw4P07sdiKgk3VcP5louLzN8w= make clang-analyzer on x86_64 defconfig caught my attention with: arch/x86/kernel/unwind_orc.c:38:7: warning: Value stored to 'mid' during its initialization is never read [clang-analyzer-deadcode.DeadStores] int *mid = first, *found = first; ^ Commit ee9f8fce9964 ("x86/unwind: Add the ORC unwinder") introduced __orc_find() with this unneeded dead-store initialization. Put the variable in local scope and initialize only once the value is needed to make clang-analyzer happy. As compilers will detect this unneeded assignment and optimize this anyway, the resulting object code is effectively identical before and after this change. No functional change. Effectively, no change to object code. Signed-off-by: Lukas Bulwahn Reviewed-by: Nathan Chancellor --- applies cleanly on current master and next-20201028 Josh, please ack. Ingo, Borislav, please pick this minor non-urgent clean-up patch. arch/x86/kernel/unwind_orc.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/x86/kernel/unwind_orc.c b/arch/x86/kernel/unwind_orc.c index 6a339ce328e0..5c64eed08257 100644 --- a/arch/x86/kernel/unwind_orc.c +++ b/arch/x86/kernel/unwind_orc.c @@ -35,7 +35,7 @@ static struct orc_entry *__orc_find(int *ip_table, struct orc_entry *u_table, { int *first = ip_table; int *last = ip_table + num_entries - 1; - int *mid = first, *found = first; + int *found = first; if (!num_entries) return NULL; @@ -47,7 +47,7 @@ static struct orc_entry *__orc_find(int *ip_table, struct orc_entry *u_table, * ignored when they conflict with a real entry. */ while (first <= last) { - mid = first + ((last - first) / 2); + int *mid = first + ((last - first) / 2); if (orc_ip(mid) <= ip) { found = mid;