From patchwork Wed Nov 6 16:41:18 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Petr_=C5=A0tetiar?= X-Patchwork-Id: 1190552 X-Patchwork-Delegate: ynezz@true.cz Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.openwrt.org (client-ip=2607:7c80:54:e::133; helo=bombadil.infradead.org; envelope-from=openwrt-devel-bounces+incoming=patchwork.ozlabs.org@lists.openwrt.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=true.cz Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="IhRs+6nt"; dkim-atps=neutral Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:e::133]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 477XPT6wbjz9sP6 for ; Thu, 7 Nov 2019 03:42:05 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:Subject:MIME-Version:Message-Id:Date:To :From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=nDTj+f4kIqpgGR6Ific5oOqQQQdcaRkeX+m2/l4tK9k=; b=IhRs+6ntJlgs3b 532Tc6b+sLCGTlh7aRkofqywLMc7JUh6HSbrTRwM9eX5H+JTz7Ef3ODAa4I6GqIpg2AV1CGock50E R90+M6/bokhwGa1w4J/Ec4dJlBi480gqUActLmkZUb48hNAgYhJO4lDoxRRdw6uocaG5op/3LOjtk lvBGOzIfO29avtgvoTvYRRYgoWhs604Tt4iWBgPcPplK7Jj1LJeSCio5QmhWxA5onspe6Vad46Q0I /uqFaCqRkrNDxQ/XJvLtcDeI9/ASAsdTg+eOV9VHW392KjbErTMD3TVWeI1dn5I3jRLE8OPBFRG01 zxy9uSzr+hOYntm7V5Xw==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1iSONU-0003V9-4y; Wed, 06 Nov 2019 16:41:52 +0000 Received: from smtp-out.xnet.cz ([178.217.244.18]) by bombadil.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1iSON7-00031j-7R for openwrt-devel@lists.openwrt.org; Wed, 06 Nov 2019 16:41:31 +0000 Received: from meh.true.cz (meh.true.cz [108.61.167.218]) (Authenticated sender: petr@true.cz) by smtp-out.xnet.cz (Postfix) with ESMTPSA id BB4954E5F; Wed, 6 Nov 2019 17:41:26 +0100 (CET) Received: by meh.true.cz (OpenSMTPD) with ESMTP id 5f0f54e7; Wed, 6 Nov 2019 17:41:16 +0100 (CET) From: =?utf-8?q?Petr_=C5=A0tetiar?= To: openwrt-devel@lists.openwrt.org Date: Wed, 6 Nov 2019 17:41:18 +0100 Message-Id: <20191106164120.5329-1-ynezz@true.cz> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20191106_084129_422630_DCDEA4A7 X-CRM114-Status: UNSURE ( 6.11 ) X-CRM114-Notice: Please train this message. X-Spam-Score: 0.0 (/) X-Spam-Report: SpamAssassin version 3.4.2 on bombadil.infradead.org summary: Content analysis details: (0.0 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [178.217.244.18 listed in list.dnswl.org] 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record 0.0 SPF_NONE SPF: sender does not publish an SPF Record Subject: [OpenWrt-Devel] [PATCH libnl-tiny 1/3] use offsetof macro to make scan-build happy X-BeenThere: openwrt-devel@lists.openwrt.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: =?utf-8?q?Petr_=C5=A0tetiar?= Sender: "openwrt-devel" Errors-To: openwrt-devel-bounces+incoming=patchwork.ozlabs.org@lists.openwrt.org scan-build from clang version 9 complains about following: cache.c:106:2: warning: Dereference of null pointer nl_list_for_each_entry_safe(obj, tmp, &cache->c_items, ce_list) ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ include/netlink/list.h:83:20: note: expanded from macro 'nl_list_for_each_entry_safe' pos = n, n = nl_list_entry(n->member.next, typeof(*n), member)) ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ include/netlink/list.h:60:2: note: expanded from macro 'nl_list_entry' nl_container_of(ptr, type, member) ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ include/netlink/list.h:56:55: note: expanded from macro 'nl_container_of' const typeof( ((type *)0)->member ) *__mptr = (ptr); \ ^~~~~ Signed-off-by: Petr Štetiar --- include/netlink/list.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/include/netlink/list.h b/include/netlink/list.h index c6876a77f76c..6eae2160327a 100644 --- a/include/netlink/list.h +++ b/include/netlink/list.h @@ -12,6 +12,8 @@ #ifndef NETLINK_LIST_H_ #define NETLINK_LIST_H_ +#include + struct nl_list_head { struct nl_list_head * next; @@ -54,7 +56,7 @@ static inline int nl_list_empty(struct nl_list_head *head) #define nl_container_of(ptr, type, member) ({ \ const typeof( ((type *)0)->member ) *__mptr = (ptr); \ - (type *)( (char *)__mptr - ((size_t) &((type *)0)->member));}) + (type *) ((char *) __mptr - (offsetof(type, member)));}) #define nl_list_entry(ptr, type, member) \ nl_container_of(ptr, type, member)