From nobody Tue May 13 18:25:09 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail(p=none dis=none) header.from=gmail.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 153048147354029.54409103420562; Sun, 1 Jul 2018 14:44:33 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.26]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id DC9D2308A94D; Sun, 1 Jul 2018 21:44:31 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 3FF2E30C43A4; Sun, 1 Jul 2018 21:44:31 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id E96FD4A469; Sun, 1 Jul 2018 21:44:30 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w61Li4qn008998 for ; Sun, 1 Jul 2018 17:44:04 -0400 Received: by smtp.corp.redhat.com (Postfix) id AA19C6016F; Sun, 1 Jul 2018 21:44:04 +0000 (UTC) Received: from mx1.redhat.com (ext-mx03.extmail.prod.ext.phx2.redhat.com [10.5.110.27]) by smtp.corp.redhat.com (Postfix) with ESMTPS id A247C600C9 for ; Sun, 1 Jul 2018 21:44:04 +0000 (UTC) Received: from mail-pg0-f66.google.com (mail-pg0-f66.google.com [74.125.83.66]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id AD65783F3C for ; Sun, 1 Jul 2018 21:43:53 +0000 (UTC) Received: by mail-pg0-f66.google.com with SMTP id q14-v6so6195564pgt.13 for ; Sun, 01 Jul 2018 14:43:53 -0700 (PDT) Received: from centos.localdomain ([157.37.164.55]) by smtp.gmail.com with ESMTPSA id v68-v6sm15006933pfv.143.2018.07.01.14.43.51 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 01 Jul 2018 14:43:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id:in-reply-to:references; bh=1ij7vJIt8phIjOBicEqy2kqlnUGJT4Q/glKOQvdhSs0=; b=Cf2Qu33mKu4dOmWymfWqefatJ9cvYxK3UvoqyutPunXcvJcDyy9/oEZi4CU0cC8ddJ QQBx/4ZZI4GiFio1FzHfQAtQi6zkx+MyzvXiaOnlESxlbYwBprxojDvOhlvLaoRcZA1A EnPRUYITSmLntqEvWON5CXjeyQT3gNvlYLLoU2w6OAgGCXTIS0QzaBTWpC/MtGnevYTO 08w4OAkmzgtCSpC4tWb67Uip/p4rt9ekMhFpxQM4mXqhh+XNIUoMoA9Q2wPmX3ssg1I4 0Buda797jCEvz7KBxhJUufVwARANMDvv3LZQlfMC3rWxCra+dlFicwq4NqFE8mq0W2Bz VJIQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references; bh=1ij7vJIt8phIjOBicEqy2kqlnUGJT4Q/glKOQvdhSs0=; b=dG6WorQAOHiU1o229/tdrknOEWqosf5t7qWornvINiEuK9b4VTnzEBHXnf/4KC5Al6 L3NI3sYxDqF3XeZO7fr8t911Mq6S7R3nb9oBTccrpR59EY8oym/mT3jL3/6KpTf+k5Rh UKdsHNEmVa12LVzdV3tUhYk/8+XnTZpZmpdmNHKXyA63hNSBRrxii3nm63O6fNj+iFoN eDDUP4hXMF8fdpzOV2NDKlXq0dNYArELv8EnL8C/WPsQZeFHBIjXu2GD0EEFEk25MSGG 6ZMNao/9EFndBP+XZiuHLXBOsdc5akubGzPjxVDO2aylbP/FWgegvS4QiSk88HaAB4lM Mrdg== X-Gm-Message-State: APt69E3yKKCHk+QX56yDfxLD6ZbR0fXFMnzYs/GwoUSRpuhEfFxm3l3/ EN7NviPD9emamajUUlc8qjQtIwzM X-Google-Smtp-Source: AAOMgpeSj0gksk+MwbM4R31AbLrLnuy8SJNm/PHQMNwA0onpgYKWEgTZV81xLASa54uekoYzj8AEnw== X-Received: by 2002:a62:1f8c:: with SMTP id l12-v6mr14238506pfj.143.1530481432980; Sun, 01 Jul 2018 14:43:52 -0700 (PDT) From: Sukrit Bhatnagar To: libvir-list@redhat.com Date: Sat, 30 Jun 2018 14:30:06 +0530 Message-Id: <1530349239-22049-3-git-send-email-skrtbhtngr@gmail.com> In-Reply-To: <1530349239-22049-1-git-send-email-skrtbhtngr@gmail.com> References: <1530349239-22049-1-git-send-email-skrtbhtngr@gmail.com> X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.27]); Sun, 01 Jul 2018 21:43:53 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.27]); Sun, 01 Jul 2018 21:43:53 +0000 (UTC) for IP:'74.125.83.66' DOMAIN:'mail-pg0-f66.google.com' HELO:'mail-pg0-f66.google.com' FROM:'skrtbhtngr@gmail.com' RCPT:'' X-RedHat-Spam-Score: 1.766 * (DATE_IN_PAST_24_48, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, NML_ADSP_CUSTOM_MED, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_PASS, T_DKIM_INVALID) 74.125.83.66 mail-pg0-f66.google.com 74.125.83.66 mail-pg0-f66.google.com X-Scanned-By: MIMEDefang 2.78 on 10.5.110.27 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH v3 02/35] cfg.mk: variable initialization when declared with cleanup macro X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.84 on 10.5.11.26 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.41]); Sun, 01 Jul 2018 21:44:32 +0000 (UTC) X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" A variable, which is never assigned a value in the function, might get passed into the cleanup function which may or may not raise any errors. To maintain the correct usage, the variable must be initialized, either with a value or with NULL. This syntax-check rule takes care of that. Signed-off-by: Sukrit Bhatnagar Reviewed-by: Erik Skultety --- cfg.mk | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/cfg.mk b/cfg.mk index 6bebd0a..196d1b2 100644 --- a/cfg.mk +++ b/cfg.mk @@ -1057,6 +1057,17 @@ sc_prohibit_backslash_alignment: halt=3D'Do not attempt to right-align backslashes' \ $(_sc_search_regexp) =20 +# Some syntax rules pertaining to the usage of cleanup macros +# implementing GNU C's cleanup attribute + +# Rule to ensure that varibales declared using a cleanup macro are +# always initialized. +sc_require_attribute_cleanup_initialization: + @prohibit=3D'VIR_AUTO(FREE|PTR)\(.+\) [^=3D]+;' \ + in_vc_files=3D'\.[chx]$$' \ + halt=3D'variable declared with a cleanup macro must be initialized' \ + $(_sc_search_regexp) + # We don't use this feature of maint.mk. prev_version_file =3D /dev/null =20 --=20 1.8.3.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list