public inbox for b.a.t.m.a.n@lists.open-mesh.org
 help / color / mirror / Atom feed
From: Antonio Quartulli <antonio@meshcoding.com>
To: "The list for a Better Approach To Mobile Ad-hoc Networking"
	<b.a.t.m.a.n@lists.open-mesh.org>,
	"Linus Lüssing" <linus.luessing@web.de>
Subject: Re: [B.A.T.M.A.N.] [PATCH] batman-adv: compat: fix null pointer exception for kernels < 3.9
Date: Sun, 16 Feb 2014 14:39:44 +0100	[thread overview]
Message-ID: <5300BFA0.9080903@meshcoding.com> (raw)
In-Reply-To: <1392552062-17927-1-git-send-email-linus.luessing@web.de>

[-- Attachment #1: Type: text/plain, Size: 1146 bytes --]

On 16/02/14 13:01, Linus Lüssing wrote:
> @@ -371,12 +372,13 @@ static int __batadv_interface_tx(struct sk_buff *skb, \
>  
>  #ifndef netdev_master_upper_dev_get_rcu
>  #define netdev_master_upper_dev_get_rcu(dev) \
> -	NULL; \
> +	upper; \
>  	if (dev->priv_flags & IFF_BRIDGE_PORT) { \
>  		rcu_read_unlock(); \
>  		dev_hold(dev); \
>  		return dev; \
> -	}
> +	} else \
> +		dev = NULL;
>  

Following your patch the code in multicast.c will become:

172         do {
173                 upper = upper;
			if (dev->priv_flags & IFF_BRIDGE_PORT) {
				rcu_read_unlock();
				dev_hold(dev);
				return dev;
			} else
				dev = NULL;
174         } while (upper && !(upper->priv_flags & IFF_EBRIDGE));

am I wrong or this is going to break the while? I think there is a
missing '}'.


What about a simplified version like this:

 #define netdev_master_upper_dev_get_rcu(dev) \
-	NULL; \
-	if (dev->priv_flags & IFF_BRIDGE_PORT) { \
+	({if (dev->priv_flags & IFF_BRIDGE_PORT) { \
 		rcu_read_unlock(); \
 		dev_hold(dev); \
 		return dev; \
-	}
+	}\
+	NULL;})


Cheers,

-- 
Antonio Quartulli


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

  reply	other threads:[~2014-02-16 13:39 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-02-16 12:01 [B.A.T.M.A.N.] [PATCH] batman-adv: compat: fix null pointer exception for kernels < 3.9 Linus Lüssing
2014-02-16 13:39 ` Antonio Quartulli [this message]
2014-02-16 18:09   ` Antonio Quartulli
2014-02-18  4:45 ` Marek Lindner

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=5300BFA0.9080903@meshcoding.com \
    --to=antonio@meshcoding.com \
    --cc=b.a.t.m.a.n@lists.open-mesh.org \
    --cc=linus.luessing@web.de \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox