Received: by 2002:a05:7412:8521:b0:e2:908c:2ebd with SMTP id t33csp1799803rdf; Sun, 5 Nov 2023 15:11:50 -0800 (PST) X-Google-Smtp-Source: AGHT+IH6dROJMFzFyPMAepH8YBcdjUfU2/44fBGB6Ij//ul5kOFIMfU2bMZYjo4ntHiydgdzhWdN X-Received: by 2002:a05:6a20:c1a8:b0:162:edc2:4e9f with SMTP id bg40-20020a056a20c1a800b00162edc24e9fmr26824413pzb.62.1699225909884; Sun, 05 Nov 2023 15:11:49 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1699225909; cv=none; d=google.com; s=arc-20160816; b=dTJ2lViCHh/f5WfLugkg1Yj9y8GtqF4xHNJlWk5wdbb1EFLJcI4B1mb5h9e0afu2ht 1/+IZUWbVe48i76gm2YUcgovD7MHXWpZOPnI/7vLErstchEBgipv30rH+JDNAqrHoRp+ KF3MVEJB61JsXepIgTbgSWvM7b4BlWH9756tr3Y9sYOq0UiFAVfyc3imRcntzvs2jGDQ tWlpad3dITkhzzZfEvuYhEDZLONNnh0PKFU2hD9+kFnwBvo6/mXXlbRGr2+eVSYIxgqp ZFdBt/5qkFiaASypxRjTX7iYP1tlcH4Vk/6U+nUyFvBaGG5l959XTR9oB7odHwKi4Kv/ k4vA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=1DUwKDSpKCCoujZwgesbEIMz5irhhs12Cnx4Vl0Ca8g=; fh=eQxaXyAccT0YRLFruuNrc1KbqwfZbcuj2qX75n7tp3E=; b=aUqg39rC48vWqBnoCcYKzaOHh73eVqcVgHzLv62zpDnfo7tm+xFIXMLGL6gHVzJg1Z 8wS0vfBWP7TU7YLXp0Q4s0pRIdMJLu4m8PFnwo8hkh8O5XPYKJZyY5akt1YQGJ6FF7XX g3uE7ik+HsBHAV7NP4gh7F7sN2a80StQUyR2c4BOy9+SZlo2KOwlBD6GJJ2ii0UVYPAF 8SrbZndbZvc6vXG5I2m4efBWUt7utmNgbgmmo9ThvwTVy5OzL3m2FljH17awbDM9EfLQ fjlkkiamJn6UDZXq+YMLg8yy+Ma8neD+eLPe1i7BtbbUHAOj/Y/pFOK82TTvwlWYwl5A WfWw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux.org.uk header.s=zeniv-20220401 header.b=coXLagLq; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=zeniv.linux.org.uk Return-Path: Received: from agentk.vger.email (agentk.vger.email. [2620:137:e000::3:2]) by mx.google.com with ESMTPS id go11-20020a17090b03cb00b002800879f482si6757023pjb.87.2023.11.05.15.11.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 05 Nov 2023 15:11:49 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) client-ip=2620:137:e000::3:2; Authentication-Results: mx.google.com; dkim=pass header.i=@linux.org.uk header.s=zeniv-20220401 header.b=coXLagLq; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=zeniv.linux.org.uk Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by agentk.vger.email (Postfix) with ESMTP id 5EE0B8057DA1; Sun, 5 Nov 2023 15:11:47 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at agentk.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229715AbjKEXLd (ORCPT + 99 others); Sun, 5 Nov 2023 18:11:33 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33198 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229447AbjKEXLb (ORCPT ); Sun, 5 Nov 2023 18:11:31 -0500 Received: from zeniv.linux.org.uk (zeniv.linux.org.uk [IPv6:2a03:a000:7:0:5054:ff:fe1c:15ff]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BC7F7E0 for ; Sun, 5 Nov 2023 15:11:27 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=linux.org.uk; s=zeniv-20220401; h=Sender:In-Reply-To:Content-Type: MIME-Version:References:Message-ID:Subject:Cc:To:From:Date:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=1DUwKDSpKCCoujZwgesbEIMz5irhhs12Cnx4Vl0Ca8g=; b=coXLagLq1QpKhXPzWH6ahwOInI Mgi0VFLE9Ywd5jyZcXhtq1jsxfuT9PxXiGj/LTeBcT237IHg3i3/Kpm1jbI8gv9er0ADHOz/6VEQw 9G3wys5aCcaSEpl5fehCbzR2wlqkgoCSI7zhg5axlaHS+Ef2+kgC7n9yKIbWYiXr905w2ApxMav5A o+yP+tKpsSBEFh02r/CkMevco5cok3nORB7//t6q+bMQT9rJQ0lTbFcMSjmyjZDpgUDHy3rn2lEEE e034t5vvmaTmSvZE0oL7ZA9ZZytAsdnwmVbrWlbtGkPnu3NYdvfdcQKjOuZZ20CoROvNHLHajfzWj /JApdFgA==; Received: from viro by zeniv.linux.org.uk with local (Exim 4.96 #2 (Red Hat Linux)) id 1qzmH7-00BilM-2T; Sun, 05 Nov 2023 23:11:25 +0000 Date: Sun, 5 Nov 2023 23:11:25 +0000 From: Al Viro To: Joey Pabalinas Cc: Linux Kernel Mailing List Subject: Re: [PATCH] fs: dlm: Remove impossible to hit if statement Message-ID: <20231105231125.GR1957730@ZenIV> References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Sender: Al Viro X-Spam-Status: No, score=-0.8 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on agentk.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (agentk.vger.email [0.0.0.0]); Sun, 05 Nov 2023 15:11:47 -0800 (PST) On Sun, Nov 05, 2023 at 12:21:49PM -1000, Joey Pabalinas wrote: > Signed-off-by: Joey Pabalinas > --- > fs/dlm/member.c | 13 ++++--------- > 1 file changed, 4 insertions(+), 9 deletions(-) > > diff --git a/fs/dlm/member.c b/fs/dlm/member.c > index be7909ead71b427aa5..bf7085f21a708ab860 100644 > --- a/fs/dlm/member.c > +++ b/fs/dlm/member.c > @@ -294,19 +294,14 @@ static void add_ordered_member(struct dlm_ls > *ls, struct dlm_member *new) > memb = list_entry(tmp, struct dlm_member, list); > if (new->nodeid < memb->nodeid) > break; > } > > - if (!memb) > - list_add_tail(newlist, head); > - else { > - /* FIXME: can use list macro here */ > - newlist->prev = tmp->prev; > - newlist->next = tmp; > - tmp->prev->next = newlist; > - tmp->prev = newlist; > - } > + newlist->prev = tmp->prev; > + newlist->next = tmp; > + tmp->prev->next = newlist; > + tmp->prev = newlist; > } * whitespace-damaged diff * lack of any explanations of the reasons why patch is correct... * ... unsurprisingly so, since it is obviously broken. Sure, if you hit even a single iteration of that loop, you will have memb guaranteed to be non-NULL. Therefore, to complete the proof you only need to consider what happens if there is not a single iteration. Which is to say, what happens if the list is empty. Well, either memb is uninitialized, or there is an intialization somewhere upstream. Declaration is not far before that loop, and it is struct dlm_member *memb = NULL; Er... So for that change to be correct you need to show that the list (ls->ls_nodes) can not be empty here. Unfortunately, it looks like it very much can be empty, seeing that this is apparently the only place where elements are added to the list in question. So on the very first call it will hit your "impossible to hit" case. Which leads to... * the patch had apparently never been tested. NACKed-by: Al Viro