From patchwork Fri Aug 4 21:53:21 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Luc Van Oostenryck X-Patchwork-Id: 9882115 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 4D1E660360 for ; Fri, 4 Aug 2017 21:53:38 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3FB57288FE for ; Fri, 4 Aug 2017 21:53:38 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 346E828996; Fri, 4 Aug 2017 21:53:38 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.3 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_SPAM, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id CF15D288FE for ; Fri, 4 Aug 2017 21:53:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752555AbdHDVxh (ORCPT ); Fri, 4 Aug 2017 17:53:37 -0400 Received: from mail-wr0-f193.google.com ([209.85.128.193]:33170 "EHLO mail-wr0-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752535AbdHDVxg (ORCPT ); Fri, 4 Aug 2017 17:53:36 -0400 Received: by mail-wr0-f193.google.com with SMTP id y43so3758075wrd.0 for ; Fri, 04 Aug 2017 14:53:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=/BB4o7MJL9Fh51qOxRMApJssvApvHN4JKBgj4pL+hyM=; b=bgSQdtLp7MfcykSfeFTy1ZiEMjLZlefGSPyFtdc0O7Ij4y1lCKA0bZkKfXRcYor+/x NJo1sRDMIkTw0pQmvaEyzvHhnoza/25iqz43k/vkNzym2ydBpm11gvxTNLCdvFfa+t4s ZgS7FNTzq8Jb79J41zbz1z31BO9+eHjQ4Jx0uELwu0BuT51xJXARTvdOU/1zBnJlGMD1 QrCRLUOF6r945Zs9FOoU1iHm7q689Or2Ujxfsfu749hAGTMb/CXs4BfKwU7wSkRDMFLD uPA0jo0QzfbBh9rQtfFlhRKqYb76WqJNTkNI+Ya5vFfeDHN1+czTp2LSxbW+8gImVaNG nivQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=/BB4o7MJL9Fh51qOxRMApJssvApvHN4JKBgj4pL+hyM=; b=nIf+w8SAsxc8baQdlpRZM0Ocieh3s94Cec+DmAxnARnMJ05kIwScuQ59NfsziAK8wC 4RW+H/J/AuIu8CTGd/C3XK1UF/fLPLjhrQRn4DG/Ltx9a/91bz05ADNceNxU2D+TqxWK 1w+luL8SPfI+bsA/FaHgOmQCs790j13f6tODN9Wx2QJn2U+SsRffyE5Vf0OgbKCjGOF+ kR3y6kBCyIPxI7JEJIJWtfCwvUd/kju6vBsM4lhuJkhY3f2Qcj9oNk3QGlxGnLNIeEeJ rWVmes/MHtHYcjW88COj008MpDFjNnu76zHjgvlBeOGSSTZfvobi8h3IAK63hzsDwMK7 tAHQ== X-Gm-Message-State: AIVw111z2GnspfK5TdexHZuCOsSy7XnsL+GDT1rS5KpQf7hhFQZE+CaP Zg0NKneerJ9OXg== X-Received: by 10.223.164.208 with SMTP id h16mr2965520wrb.100.1501883615868; Fri, 04 Aug 2017 14:53:35 -0700 (PDT) Received: from localhost.localdomain ([2a02:a03f:40c4:ab00:b1b0:9c82:2611:1575]) by smtp.gmail.com with ESMTPSA id p4sm5204384wrd.50.2017.08.04.14.53.34 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 04 Aug 2017 14:53:34 -0700 (PDT) From: Luc Van Oostenryck To: Christopher Li Cc: linux-sparse@vger.kernel.org, Luc Van Oostenryck Subject: [PATCH v3 5/5] mark pseudo users as deleted instead of removing them Date: Fri, 4 Aug 2017 23:53:21 +0200 Message-Id: <20170804215321.66392-6-luc.vanoostenryck@gmail.com> X-Mailer: git-send-email 2.13.2 In-Reply-To: <20170804215321.66392-1-luc.vanoostenryck@gmail.com> References: <20170804215321.66392-1-luc.vanoostenryck@gmail.com> Sender: linux-sparse-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-sparse@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP This will fix the (rare) problems with deletion while doing nested ptrlist walking that occurs when doing recursive kill_instruction() - remove_usage() - kill_instruction() Signed-off-by: Luc Van Oostenryck --- simplify.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/simplify.c b/simplify.c index 03ff9c942..2bc86f53e 100644 --- a/simplify.c +++ b/simplify.c @@ -172,14 +172,15 @@ static int delete_pseudo_user_list_entry(struct pseudo_user_list **list, pseudo_ FOR_EACH_PTR(*list, pu) { if (pu->userp == entry) { - DELETE_CURRENT_PTR(pu); + MARK_CURRENT_DELETED(pu); if (!--count) goto out; } } END_FOR_EACH_PTR(pu); assert(count <= 0); out: - pack_ptr_list((struct ptr_list **)list); + if (ptr_list_size((struct ptr_list *) *list) == 0) + *list = NULL; return count; }