Received: by 2002:a05:6a10:16a7:0:0:0:0 with SMTP id gp39csp982416pxb; Thu, 5 Nov 2020 19:51:43 -0800 (PST) X-Google-Smtp-Source: ABdhPJyUfoTa+hj/xF/pvR64Z0LSpA6DS6OzRAb5NfezMlVx3G24Nt7DqNOYqdwkud8HhIYGsaxT X-Received: by 2002:a17:906:77c5:: with SMTP id m5mr108578ejn.424.1604634703304; Thu, 05 Nov 2020 19:51:43 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1604634703; cv=none; d=google.com; s=arc-20160816; b=xYH1YqysSlH4IvIRqfbjyNtlYJnWBswoWKppVtgETDp9JW42kjyKonbHv6MV7+4xHt 5lQBLCnV4fM0CxgMo3hpA/Cc7uTrSFLSKWqYZgdnO2PEqOoXQjx8kgOoFlR/SCLQnxKu ODnAy3l5Do1j5EqzoEWa3IAQPE3Z1YgDXZUtGDNM3zzazwFQymvty1tCWQigs17k7xlf pYIBbjP8h/FY+0Yy3BHqTUlKeuUSI/pMfiPG6sOyAFmHzm/cvpufKtqamzMA4NjbDgHp gJfn0nTOK5JTrMhY3SUrMSc9UOQmsznVVo7zLUorHkNvswLZRUwB8hgJ0Qn8B3Y9F2Sf Wy7g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=0oV6zTD6LpNnhkp+52mi6F8NkFZ6auhC3pOPfDEuyUc=; b=PsHyAjM/BnENZsFX4Ac6PO196Z4UXGokmqezrClVwQNr2DUU2FNtaxCAma0WDiusZ2 AGJGeqlkue/vLY2KewFMQnuc4hvibGia3ZjMVnxvmlj26TMlqnC1M523mE3K6CYSEviI C2VZiCwiDJiMwIrfLTwg2kBNGoOBmhuuM1cL+xZFh6bQvW4Ah6EekQbKWU4p7aJfRYCN 8+L6TBly+4oqGNsqTnK/77TuT2OCo6Vn9+do3YzvetlC360hnowtrbbFBb2ofPZCcloF GXzszx7GGhLCkfpHheTIG15LKzdzWRe737oCcn0wsg3ALtsrsOIiEYQ3b0IHXKfvomvN jmbg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=fG4iOMhy; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id nw19si2688522ejb.586.2020.11.05.19.51.20; Thu, 05 Nov 2020 19:51:43 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=fG4iOMhy; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726096AbgKFDtL (ORCPT + 99 others); Thu, 5 Nov 2020 22:49:11 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56680 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725828AbgKFDtL (ORCPT ); Thu, 5 Nov 2020 22:49:11 -0500 Received: from mail-qk1-x744.google.com (mail-qk1-x744.google.com [IPv6:2607:f8b0:4864:20::744]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6FAC2C0613CF; Thu, 5 Nov 2020 19:49:11 -0800 (PST) Received: by mail-qk1-x744.google.com with SMTP id h15so721qkl.13; Thu, 05 Nov 2020 19:49:11 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=0oV6zTD6LpNnhkp+52mi6F8NkFZ6auhC3pOPfDEuyUc=; b=fG4iOMhyr9cocSQ20LTNCxxvAKTuWBVN19dLyiJ78lvLIXovaDI3ePjfr2NZCbP5k6 c6Q0fDft8snMx0gJMcFx3tIziwybETFm2dl5NmLga/xI4rvxBYhMJRSnFlw3VLs5NTsS Etj+wgefTjFH+SaqG01qz7ZoK66TByB2k/ELHqZ8CvJ4M90d0MSQQGwsqhwHyP0Q6dL2 Tq6EVuK74i/MyExDbUycscfPB5cln1r2h9IBDMp9jFfmZUZyRprpqbRrHGqpTgk+Cljp Y2luUT+bOQ29IkU6H++bv0/j6TnEwpFBDl41ZOfCkKVs+ieY+lbaNxIMJYp0s2NBgeJL Eh0w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=0oV6zTD6LpNnhkp+52mi6F8NkFZ6auhC3pOPfDEuyUc=; b=M2R3nikqGFR+fzTZrGBecnRtH+VJu6CcWOIEhTb6tatAb8sehQcPSWF8YzSSociVBO LGHHbS0VQNNntkJk66kNAeNnHJAgfFmlMSrqOAftfj1qSfmIqvIstHd4eWKRw//PND6y xVSX4glWONxW5gcuB4MciPbuvne7Co1cgvpwkzLCSGn5bQfpw48iYVIBg3XxahgcaoU/ NwKwaOpdxMHNYaejFXGak66X/Qgah27HUSePnrOmX2WnDvhDCqbcvsT8MoqGyEP3N2M7 UWWr7fBlxg5MwlizCzVgPhp0xddZ6RKpodEy33rZ52pNW5LYmUwQe0L0fNv9SZYgB7UV hisA== X-Gm-Message-State: AOAM530yYo8z1PPTAEpkBbARKZvV6Qs5k5/326Lp41lZw94jykIYJ9Z+ aUGWH2ezYS7IezJqVrcatS4= X-Received: by 2002:a37:4796:: with SMTP id u144mr5356208qka.235.1604634550544; Thu, 05 Nov 2020 19:49:10 -0800 (PST) Received: from ubuntu-m3-large-x86 ([2604:1380:45f1:1d00::1]) by smtp.gmail.com with ESMTPSA id u2sm10411qtw.40.2020.11.05.19.49.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 05 Nov 2020 19:49:09 -0800 (PST) Date: Thu, 5 Nov 2020 20:49:08 -0700 From: Nathan Chancellor To: Lukas Bulwahn Cc: Petr Mladek , Sergey Senozhatsky , Steven Rostedt , John Ogness , Nick Desaulniers , linux-kernel@vger.kernel.org, clang-built-linux@googlegroups.com, kernel-janitors@vger.kernel.org, linux-safety@lists.elisa.tech Subject: Re: [PATCH] printk: remove unneeded dead-store assignment Message-ID: <20201106034908.GA2143960@ubuntu-m3-large-x86> References: <20201106034005.18822-1-lukas.bulwahn@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20201106034005.18822-1-lukas.bulwahn@gmail.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Nov 06, 2020 at 04:40:05AM +0100, Lukas Bulwahn wrote: > make clang-analyzer on x86_64 defconfig caught my attention with: > > kernel/printk/printk_ringbuffer.c:885:3: warning: > Value stored to 'desc' is never read [clang-analyzer-deadcode.DeadStores] > desc = to_desc(desc_ring, head_id); > ^ > > Commit b6cf8b3f3312 ("printk: add lockless ringbuffer") introduced > desc_reserve() with this unneeded dead-store assignment. > > As discussed with John Ogness privately, this is probably just some minor > left-over from previous iterations of the ringbuffer implementation. So, > simply remove this unneeded dead assignment to make clang-analyzer happy. > > As compilers will detect this unneeded assignment and optimize this anyway, > the resulting object code is identical before and after this change. > > No functional change. No change to object code. > > Signed-off-by: Lukas Bulwahn Reviewed-by: Nathan Chancellor > --- > applies cleanly on current master and next-20201105 > > John, please ack. > Petr, please pick this minor non-urgent clean-up patch. > > kernel/printk/printk_ringbuffer.c | 2 -- > 1 file changed, 2 deletions(-) > > diff --git a/kernel/printk/printk_ringbuffer.c b/kernel/printk/printk_ringbuffer.c > index 6b1525685277..74e25a1704f2 100644 > --- a/kernel/printk/printk_ringbuffer.c > +++ b/kernel/printk/printk_ringbuffer.c > @@ -882,8 +882,6 @@ static bool desc_reserve(struct printk_ringbuffer *rb, unsigned long *id_out) > head_id = atomic_long_read(&desc_ring->head_id); /* LMM(desc_reserve:A) */ > > do { > - desc = to_desc(desc_ring, head_id); > - > id = DESC_ID(head_id + 1); > id_prev_wrap = DESC_ID_PREV_WRAP(desc_ring, id); > > -- > 2.17.1 >