From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from out-186.mta1.migadu.com (out-186.mta1.migadu.com [95.215.58.186]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B465B349B08 for ; Thu, 4 Dec 2025 19:23:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=95.215.58.186 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1764876191; cv=none; b=FYKH9BExQ2ZdzNS90Seyc0wz/7te91ejGxrUFY/bk3vFsv70COWVd7GO7JnFObEMTgTL9u2Hu1RFxkIleZVuvqiNTj1fFdyadpG44m4ES83BxJtFmWzgkNVwJ/2nDr60rka7kQED6WxQvG47epBTeOCo3jM6vO0l2m4z3Ea4gkw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1764876191; c=relaxed/simple; bh=7pSiqUQ0aE25Owr8KVxqEw2Nc2UA5jkORFfpWUV9dkI=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=TcUY062aQ++zRqmTgKuq/YE7x+JZN8P4iDb5VAPJpsCGCE7NDCj68nHVhW+tr1wyzm3y+zi8kE+HQ+jcFX5QdqqPpLkAxZeerxLga90Vvz4jolI3S34cltk6SerRqTBMwsVgXcVtZ0KyN4GMrIkJk4qHyn+fpKHQxq5kvYFW/Wo= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev; spf=pass smtp.mailfrom=linux.dev; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b=lvE0ynI1; arc=none smtp.client-ip=95.215.58.186 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.dev Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="lvE0ynI1" Message-ID: <2eca9f77-72bf-4808-a1b6-d87be2777537@linux.dev> DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1764876187; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=E2cstCg4WIhJrfUo/YjWBi9Zxe5Xadh9nAuh/A5TZU4=; b=lvE0ynI1DrBNWOQVofMU6NpHj3103DKcPdx6v/mQC6Eh33On7oc06JfWDI1hKbyTfxBwBv Gvy9ctnHbvxF+SxA7ogESCeQWmkwFaY7hBW07qNaQy6pXSriqMUaG52Dgyxr+ytM3TrH8H cEIZQQjC3P6D5LMQ1e1iSie7L4LIblw= Date: Thu, 4 Dec 2025 11:22:53 -0800 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Subject: Re: [PATCH] bpf: avoid warning for unused register_bpf_struct_ops() To: Arnd Bergmann Cc: Alexei Starovoitov , Daniel Borkmann , Andrii Nakryiko , Dust Li , "D. Wythe" , Arnd Bergmann , Kui-Feng Lee , Martin KaFai Lau , Eduard Zingerman , Song Liu , Yonghong Song , John Fastabend , KP Singh , Stanislav Fomichev , Hao Luo , Jiri Olsa , Kumar Kartikeya Dwivedi , Mykyta Yatsenko , Tao Chen , Anton Protopopov , bpf@vger.kernel.org, linux-kernel@vger.kernel.org References: <20251204094312.1029643-1-arnd@kernel.org> Content-Language: en-US X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. From: Martin KaFai Lau In-Reply-To: <20251204094312.1029643-1-arnd@kernel.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Migadu-Flow: FLOW_OUT On 12/4/25 1:42 AM, Arnd Bergmann wrote: > From: Arnd Bergmann > > The macro originally introduced in commit f6be98d19985 ("bpf, net: > switch to dynamic registration") causes a warning in the new smc code > because of the way it evaluates the arguments: > > In file included from include/linux/bpf_verifier.h:7, > from net/smc/smc_hs_bpf.c:13: > net/smc/smc_hs_bpf.c: In function 'bpf_smc_hs_ctrl_init': > include/linux/bpf.h:2076:50: error: statement with no effect [-Werror=unused-value] > 2076 | #define register_bpf_struct_ops(st_ops, type) ({ (void *)(st_ops); 0; }) > | ^~~~~~~~~~~~~~~~ > net/smc/smc_hs_bpf.c:139:16: note: in expansion of macro 'register_bpf_struct_ops' > 139 | return register_bpf_struct_ops(&bpf_smc_hs_ctrl_ops, smc_hs_ctrl); > | ^~~~~~~~~~~~~~~~~~~~~~~ > > Work around this using an inline function that takes the argument, > the same way as the normal implementation. Since the second argument to > register_bpf_struct_ops() is a type rather than an object, this still > has to be a macro, but it can call a new inline helper internally like > the normal one does. Thanks for the patch. This has been fixed in "https://lore.kernel.org/bpf/988c61e5fea280872d81b3640f1f34d0619cfbbf.1764843951.git.geert@linux-m68k.org/" to completely remove its usage from smc. The smc usage without CONFIG_BPF_JIT was an overlook. This empty register_bpf_struct_ops should be removed from the bpf-next tree as a cleanup.