netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Stefano Babic <stefano.babic@babic.homelinux.org>
To: sjur.brandeland@stericsson.com
Cc: netdev@vger.kernel.org, kim.xx.lilliestierna@stericsson.com,
	christian.bejram@stericsson.com,
	daniel.martensson@stericsson.com
Subject: Re: [PATCH] [CAIF-RFC 5/8-v2] CAIF Protocol Stack
Date: Mon, 12 Oct 2009 14:51:08 +0200	[thread overview]
Message-ID: <4AD3263C.9010605@babic.homelinux.org> (raw)
In-Reply-To: <1255095571-6501-6-git-send-email-sjur.brandeland@stericsson.com>

sjur.brandeland@stericsson.com wrote:
> From: Sjur Braendeland <sjur.brandeland@stericsson.com>

Hi Sjur,

> diff --git a/net/caif/caif_chr.c b/net/caif/caif_chr.c

> +#define caif_assert(assert) BUG_ON(!(assert))

Do we need special assert for each module (cfglu_assert,
caif_assert,...) ? They are all defined in the same way.
At this point I have already set a comment about using BUG_ON in a
previous patch.

I see a mixed policy in this patch, using sometimes _assert and
sometimes directly BUG_ON, too.

> diff --git a/net/caif/chnl_chr.c b/net/caif/chnl_chr.c

> +	/* Lock in order to try to stop someone from opening the device
> +	   too early. The misc device has its own lock. We cannot take our
> +	   lock until misc_register() is finished, because in open() the
> +	   locks are taken in this order (misc first and then dev).
> +	   So anyone managing to open the device between the misc_register
> +	   and the mutex_lock will get a "device not found" error. Don't
> +	   think it can be avoided.
> +	 */
> +	mutex_lock_interruptible(&dev->mutex);

The return value is not checked and it must be, as in all other cases.

> +	/* Find device from name */
> +	dev = find_device(-1, name, 0);
> +	if (!dev)
> +		return -EBADF;
> +
> +

> +	mutex_lock_interruptible(&dev->mutex);

The return value of mutex_lock_interruptible() must be checked.

Stefano

-- 
stefano <stefano.babic@babic.homelinux.org>
GPG Key: 0x55814DDE
Fingerprint 4E85 2A66 4CBA 497A 2A7B D3BF 5973 F216 5581 4DDE

  parent reply	other threads:[~2009-10-12 12:52 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-10-09 13:39 [PATCH] [CAIF-RFC 0/8-v2] CAIF Protocol Stack sjur.brandeland
2009-10-09 13:39 ` [PATCH] [CAIF-RFC 1/8-v2] " sjur.brandeland
2009-10-09 13:39   ` [PATCH] [CAIF-RFC 2/8-v2] " sjur.brandeland
2009-10-09 13:39     ` [PATCH] [CAIF-RFC 3/8-v2] " sjur.brandeland
2009-10-09 13:39       ` [PATCH] [CAIF-RFC 4/8-v2] " sjur.brandeland
2009-10-09 13:39         ` [PATCH] [CAIF-RFC 5/8-v2] " sjur.brandeland
2009-10-09 13:39           ` [PATCH] [CAIF-RFC 6/8-v2] " sjur.brandeland
2009-10-09 13:39             ` [PATCH] [CAIF-RFC 7/8-v2] " sjur.brandeland
2009-10-09 13:39               ` [PATCH] [CAIF-RFC 8/8-v2] " sjur.brandeland
2009-10-12 13:43               ` [PATCH] [CAIF-RFC 7/8-v2] " Stefano Babic
2009-10-12 13:06             ` [PATCH] [CAIF-RFC 6/8-v2] " Stefano Babic
2009-10-09 16:43           ` [PATCH] [CAIF-RFC 5/8-v2] " Randy Dunlap
2009-10-12 12:51           ` Stefano Babic [this message]
2009-10-12 12:20         ` [PATCH] [CAIF-RFC 4/8-v2] " Stefano Babic
2009-10-12  9:28     ` [PATCH] [CAIF-RFC 2/8-v2] " Stefano Babic
2009-10-12  8:08   ` [PATCH] [CAIF-RFC 1/8-v2] " Stefano Babic
2009-10-12  8:20     ` David Miller
2009-10-12  9:41 ` [PATCH] [CAIF-RFC 0/8-v2] " David Miller

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=4AD3263C.9010605@babic.homelinux.org \
    --to=stefano.babic@babic.homelinux.org \
    --cc=christian.bejram@stericsson.com \
    --cc=daniel.martensson@stericsson.com \
    --cc=kim.xx.lilliestierna@stericsson.com \
    --cc=netdev@vger.kernel.org \
    --cc=sjur.brandeland@stericsson.com \
    /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;
as well as URLs for NNTP newsgroup(s).