All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Linus Lüssing" <linus.luessing@c0d3.blue>
To: The list for a Better Approach To Mobile Ad-hoc Networking
	<b.a.t.m.a.n@lists.open-mesh.org>
Subject: Re: [PATCH v3 3/5] batman-adv: mcast: implement multicast packet reception and forwarding
Date: Tue, 27 Dec 2022 12:58:41 +0100	[thread overview]
Message-ID: <Y6rd8cwPi8JqTbkN@sellars> (raw)
In-Reply-To: <8399468.NyiUUSuA9g@sven-l14>

On Tue, Dec 27, 2022 at 10:07:36AM +0100, Sven Eckelmann wrote:
> ecsv/pu: checkpatch ./net/batman-adv/multicast_forw.c
> -----------------------------------------------------
> 
>     CHECK: Macro argument reuse 'num_dests' - possible side-effects?
>     #25: FILE: ./net/batman-adv/multicast_forw.c:25:
>     +#define batadv_mcast_forw_tracker_for_each_dest(dest, num_dests) \
>     +   for (; num_dests; num_dests--, (dest) += ETH_ALEN)
>     
>     total: 0 errors, 0 warnings, 1 checks, 274 lines checked
> 

For this I'm not quite sure how to best silence this. I tried
the workaround of passing num_dests as a pointer and dereferencing
it inside the macro:

#define batadv_mcast_forw_tracker_for_each_dest(dest, num_dests) \
        for (; (*(num_dests)); (*(num_dests))--, (dest) += ETH_ALEN)

So just like you'd do if you would want intentional side-effects with
a normal function. But seems like checkpatch does not recoginze it.

Also all the other for_each macros in the kernel code have
side-effects, as far as I know?

Or would you have another idea?

  reply	other threads:[~2022-12-27 11:58 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-12-26 20:42 [PATCH v3 0/5] Implementation of a Stateless Multicast Packet Type Linus Lüssing
2022-12-26 20:42 ` [PATCH v3 1/5] batman-adv: mcast: remove now redundant single ucast forwarding Linus Lüssing
2022-12-26 20:42 ` [PATCH v3 2/5] batman-adv: tvlv: prepare for tvlv enabled multicast packet type Linus Lüssing
2022-12-26 20:42 ` [PATCH v3 3/5] batman-adv: mcast: implement multicast packet reception and forwarding Linus Lüssing
2022-12-27  9:07   ` Sven Eckelmann
2022-12-27 11:58     ` Linus Lüssing [this message]
2022-12-27 12:47       ` Sven Eckelmann
2022-12-26 20:42 ` [PATCH v3 4/5] batman-adv: mcast: implement multicast packet generation Linus Lüssing
2022-12-27  9:34   ` Sven Eckelmann
2022-12-26 20:42 ` [PATCH v3 5/5] batman-adv: mcast: shrink tracker packet after scrubbing Linus Lüssing
2022-12-27 10:46   ` Sven Eckelmann

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Y6rd8cwPi8JqTbkN@sellars \
    --to=linus.luessing@c0d3.blue \
    --cc=b.a.t.m.a.n@lists.open-mesh.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.