From nobody Sat Feb 7 21:16:10 2026 Received: from mail-dy1-f174.google.com (mail-dy1-f174.google.com [74.125.82.174]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 173193ACEF3 for ; Tue, 3 Feb 2026 14:55:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=74.125.82.174 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770130538; cv=none; b=AqUEkVwaQyi7fbEeFic6gpEKYyLQLGLh2EdYbKAKdxICtIMblbz1p1OwpsjcWZ/I+Lq104bTGyDUZ70y46pnqMG3qYrWJUFThhwk0M1P12pSXd4WzV80YaO7ZbvcmZobN5KhxOS9A1kaodCw1zPFiHncH1LjUTPajlcOcmyJ9DU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770130538; c=relaxed/simple; bh=NRgVJBul0Y8zpGSgGKNgKM+I9r7ovGTkQ6APHRuS7mE=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=t5Rf0FoBk2Tm/opZ4Gxe+OYAV5CISsVS5pjb2Wi6ZrJl3ZnbVvH3thD1FtGLKaZJd4Va2flKfDEO5nqu6hdWly+02KCTglhivbH6/J9AFMsl0fMRZ32xFaFG4Kaq2RcRd3y7ND0TYMIh+J1OLD1681eEyEmjTQEqertZTM4bpZ0= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=lMgcB7gV; arc=none smtp.client-ip=74.125.82.174 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="lMgcB7gV" Received: by mail-dy1-f174.google.com with SMTP id 5a478bee46e88-2b7070acfdcso6244415eec.0 for ; Tue, 03 Feb 2026 06:55:35 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1770130533; x=1770735333; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=ARM7OCB27g2Bz6Y1P5CF31jTt4HxwnIXMV7CLDf4O6g=; b=lMgcB7gVLJBqTU6jI+7fIlgIRS3Vf8c5SWyknBT7xxEXWcWGwdv9zTuwu4rNlEm6iI 797OXgkwkgvklpjyzSqmztvg2yMR8o3/YY/84nfBKDhsaJA7QwVAY8a2YflCt5M/mD0v fdJjKHv+Rmf0gHSBexfJCKxPLLtXB4iKBfpTLlQPuWaD6oLFwSs31vr5+/nVNMV10xGL jv0tQkhNaOcUy5sjfg+aWQWp5fIJbW0MmQskvMUihYS+E9DK/mgM+acQakQmF4buGXDk f/UyVOuktw8HZzmNJUVxxcwxAJ7ztOFFe5DRkVAD95RQxePX2gT53O2bty/O/DXufsU9 Nu6A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1770130533; x=1770735333; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=ARM7OCB27g2Bz6Y1P5CF31jTt4HxwnIXMV7CLDf4O6g=; b=mApgcTOWvaYx7cdIoX0nYN24SReLctfcFDbZegYWNuMmrA1UOQ0vxqAqpfeyFKXVFz st7Xvq56EVlNFZKWb+oNUsLUYaw04BBONpm8/Cj/vHLU8sRyJwBWAddZ+pac3Nri307C MrolLnNeT7n6fAzOZsfp+X3JSkG4UhLtAGDXLWtZCQtl8unF1IdLrkXS6TjXRr4q0GyG Sl+b+YsOD4J71FqZdBCi244twMO57ibdLdWlwMPEAXf2SCUVkYc/hBlVbR5PltnYyNad tkURi0t1t9IPszqHv8CnFn7FOJf0/Y7m2nR5dAYBrTJ5B2hJLfIWrF02rriWrVUXPMLL ytAA== X-Forwarded-Encrypted: i=1; AJvYcCVebSHZg5AuUjP2YNMqF9zyYDrtVL8jCn40YLyiZsf1fcDtDD3Zu7V4qDZYqJqlnwDtt+Ya021+LdBkF2I=@vger.kernel.org X-Gm-Message-State: AOJu0Yx9nYNEvT8kRzpLKOGLZNwH5qkRW55trh6ig0kwlbSdbPaZ8Ldq n687CkKRpy9PLHjaJPoZC6XvA+I8aiaR6+tyTbAOlwf8CpPtFsmU6kWL X-Gm-Gg: AZuq6aK1pfDYiFaAbLXwegvc6UtIey8E0f8yvZ/IRsJ2LeqPrfWPj7Ry+SH/mIg5vxT 3Iut9iZxnkZWpoAZsBfk+DNOKK5vWsdBbtVXNNrOj9CjSJdPxC0VSYCIQee4DtKJbCm3LB+ewED WdzF1Fr9kVZj8K9zCOeSYFOFbZsCBaETEgSS9atU9IG7wEFNKrCCL2ODDv+levdxwbMP4F6WFGo Fy4d27yjuExdFl6k1iftNn0J8QiLMBOjp4mjLx4iW9zNNaTiAdjnTdb3aaxlIZ+1n40U0LWQTYD fkNcCDrAFK2qsMUiwIwad2PydO09SSQj16puUUaO5LVtUWo8k9ly4ByQ5eYNqRbuDsc6dHvxk0q mSwFYA0D0VKchfS0M6aoAzSdKlnvMPDOoX6+qg8q4bxFv7ou+2AjhK2TRlh95ZzUqG9I3dXR+Jc F8LeEyjltQgZ0fekbdRjt0U/CIBBgR5vwuR0F0UjZnPmAqHMTXs95JnkQwQopu/Bhn29undS7VJ mMEOYdI0kcWQw6bAjfG X-Received: by 2002:a05:7300:220f:b0:2b8:209d:5980 with SMTP id 5a478bee46e88-2b8209d5c4amr1327259eec.30.1770130533426; Tue, 03 Feb 2026 06:55:33 -0800 (PST) Received: from localhost.localdomain (108-214-96-168.lightspeed.sntcca.sbcglobal.net. [108.214.96.168]) by smtp.gmail.com with ESMTPSA id 5a478bee46e88-2b7a16ef40asm21806765eec.13.2026.02.03.06.55.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 03 Feb 2026 06:55:33 -0800 (PST) From: Sun Jian To: Florian Westphal Cc: Pablo Neira Ayuso , Phil Sutter , Simon Horman , netfilter-devel@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Sun Jian Subject: [PATCH v2] netfilter: amanda: fix RCU pointer typing for nf_nat_amanda_hook Date: Tue, 3 Feb 2026 22:55:11 +0800 Message-ID: <20260203145511.164485-1-sun.jian.kdev@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260203080109.2682183-1-sun.jian.kdev@gmail.com> References: <20260203080109.2682183-1-sun.jian.kdev@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Sparse reports "incompatible types in comparison expression" error in nf_conntrack_amanda.c because nf_nat_amanda_hook is used with rcu_dereference() but lacks the proper __rcu annotation. Fix this by correctly placing the __rcu annotation inside the pointer parentheses in both the declaration and definition. This allows the standard rcu_dereference() to work correctly. Suggested-by: Florian Westphal Signed-off-by: Sun Jian --- v2: - Correctly place __rcu annotation inside the parentheses as suggested by Florian Westphal. - Use standard rcu_dereference() instead of rcu_dereference_raw(). --- include/linux/netfilter/nf_conntrack_amanda.h | 12 +++++------ net/netfilter/nf_conntrack_amanda.c | 21 ++++++++++++------- 2 files changed, 19 insertions(+), 14 deletions(-) diff --git a/include/linux/netfilter/nf_conntrack_amanda.h b/include/linux/= netfilter/nf_conntrack_amanda.h index 6f0ac896fcc9..9f957598a9da 100644 --- a/include/linux/netfilter/nf_conntrack_amanda.h +++ b/include/linux/netfilter/nf_conntrack_amanda.h @@ -7,10 +7,10 @@ #include #include =20 -extern unsigned int (*nf_nat_amanda_hook)(struct sk_buff *skb, - enum ip_conntrack_info ctinfo, - unsigned int protoff, - unsigned int matchoff, - unsigned int matchlen, - struct nf_conntrack_expect *exp); +extern unsigned int (__rcu *nf_nat_amanda_hook)(struct sk_buff *skb, + enum ip_conntrack_info ctinfo, + unsigned int protoff, + unsigned int matchoff, + unsigned int matchlen, + struct nf_conntrack_expect *exp); #endif /* _NF_CONNTRACK_AMANDA_H */ diff --git a/net/netfilter/nf_conntrack_amanda.c b/net/netfilter/nf_conntra= ck_amanda.c index 7be4c35e4795..2e3753758b9b 100644 --- a/net/netfilter/nf_conntrack_amanda.c +++ b/net/netfilter/nf_conntrack_amanda.c @@ -37,13 +37,13 @@ MODULE_PARM_DESC(master_timeout, "timeout for the maste= r connection"); module_param(ts_algo, charp, 0400); MODULE_PARM_DESC(ts_algo, "textsearch algorithm to use (default kmp)"); =20 -unsigned int (*nf_nat_amanda_hook)(struct sk_buff *skb, - enum ip_conntrack_info ctinfo, - unsigned int protoff, - unsigned int matchoff, - unsigned int matchlen, - struct nf_conntrack_expect *exp) - __read_mostly; +unsigned int (__rcu *nf_nat_amanda_hook)(struct sk_buff *skb, + enum ip_conntrack_info ctinfo, + unsigned int protoff, + unsigned int matchoff, + unsigned int matchlen, + struct nf_conntrack_expect *exp) + __read_mostly; EXPORT_SYMBOL_GPL(nf_nat_amanda_hook); =20 enum amanda_strings { @@ -98,7 +98,12 @@ static int amanda_help(struct sk_buff *skb, u_int16_t len; __be16 port; int ret =3D NF_ACCEPT; - typeof(nf_nat_amanda_hook) nf_nat_amanda; + unsigned int (*nf_nat_amanda)(struct sk_buff *skb, + enum ip_conntrack_info ctinfo, + unsigned int protoff, + unsigned int matchoff, + unsigned int matchlen, + struct nf_conntrack_expect *exp); =20 /* Only look at packets from the Amanda server */ if (CTINFO2DIR(ctinfo) =3D=3D IP_CT_DIR_ORIGINAL) --=20 2.43.0