b.a.t.m.a.n.lists.open-mesh.org archive mirror
 help / color / mirror / Atom feed
From: Simon Wunderlich <simon.wunderlich@s2003.tu-chemnitz.de>
To: The list for a Better Approach To Mobile Ad-hoc Networking
Subject: Re: [B.A.T.M.A.N.] Coccinelle tests?
Date: Fri, 1 Jan 2010 17:38:41 +0100	[thread overview]
Message-ID: <20100101163841.GB16855@pandem0nium> (raw)
In-Reply-To: <20091231170753.GA27707@lunn.ch>

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

Hey Andrew,

thanks for forwarding! I've commited a patch, revision 1527, which should
fix these things. See some comments inline below.

best regards,

On Thu, Dec 31, 2009 at 06:07:53PM +0100, Andrew Lunn wrote:
> ***dev->dev_addr is a pointer.  The size of an address is probably 6.  dev
> has an addr_len field that might be initialized.

fixed in r1527.

> *** Use kzalloc instead of kmalloc + memset.  Also consider testing the result
> of the kmaloc for NULL.

kzalloc is a good suggestion, done in r1527.
kmalloc checking should be fixed in r1520, r1521, r1524.

> *** As far as I can tell, in the following, the if after the out label is not
> needed.

correct, this was already fixed in r1493.
> *** the result of kmalloc should be tested for NULL

correct, but not needed anymore as we have changed to static initialization in 

> diff -u -p /var/linuxes/linux-next/drivers/staging/batman-adv/translation-table.c /tmp/nothing
> --- /var/linuxes/linux-next/drivers/staging/batman-adv/translation-table.c	2009-12-19 09:38:58.000000000 +0100
> @@ -322,7 +322,6 @@ void hna_global_add_orig(struct orig_nod
>  	if (orig_node->hna_buff_len > 0) {
>  		orig_node->hna_buff = kmalloc(orig_node->hna_buff_len,
>  					      GFP_ATOMIC);
> -		memcpy(orig_node->hna_buff, hna_buff, orig_node->hna_buff_len);
>  	} else {
>  		orig_node->hna_buff = NULL;
>  	}
this one again: kmalloc checking should be fixed in r1520, r1521, r1524.

> returns.cocci
> *** Perhaps there is no point to put a return by itself at the end of a
> function.

okay, done in r1527.
> diff -u -p a/routing.c b/routing.c
> --- a/routing.c 2009-12-19 09:38:58.000000000 +0100
> +++ b/routing.c 2009-12-31 14:59:41.000000000 +0100
> @@ -627,7 +626,6 @@ static void recv_my_icmp_packet(struct e
>  	}
>  	spin_unlock(&orig_hash_lock);
> -	return;
>  }

I did not find this return (probably due to the skb restructuring),
but all the other useless returns; should be gone now (r1527).

>  static void recv_icmp_ttl_exceeded(struct icmp_packet *icmp_packet,
> txok.cocci
> *** I saw in some patch that functions store in the field .ndo_start_xmit
> ought to return NETDEV_TX_OK rather than 0.  I haven't submitted any patches
> of my own for this situation, so I don't know for sure what the rule is.

OK, most drivers seem to do this, so we'll do the same (r1527)

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 197 bytes --]

      reply	other threads:[~2010-01-01 16:38 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-12-31 17:07 [B.A.T.M.A.N.] Coccinelle tests? Andrew Lunn
2010-01-01 16:38 ` Simon Wunderlich [this message]

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:

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

  git send-email \
    --in-reply-to=20100101163841.GB16855@pandem0nium \
    --to=simon.wunderlich@s2003.tu-chemnitz.de \
    --cc=b.a.t.m.a.n@lists.open-mesh.net \


* 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;
as well as URLs for NNTP newsgroup(s).