public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Harvey Harrison <harvey.harrison@gmail.com>
To: Stefan Richter <stefanr@s5r6.in-berlin.de>
Cc: righi.andrea@gmail.com, Johannes Weiner <hannes@cmpxchg.org>,
	Dave Jones <davej@redhat.com>,
	Johannes Weiner <hannes@saeurebad.de>,
	Krzysztof Helt <krzysztof.h1@wp.pl>,
	Andrew Morton <akpm@linux-foundation.org>,
	LKML <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] fbmem: fix copy_from/to_user() with mutex held
Date: Mon, 19 Jan 2009 00:10:39 -0800	[thread overview]
Message-ID: <1232352639.5570.8.camel@brick> (raw)
In-Reply-To: <49743444.8070206@s5r6.in-berlin.de>

On Mon, 2009-01-19 at 09:05 +0100, Stefan Richter wrote:
> Stefan Richter wrote:
> > Andrea Righi wrote:
> >> +struct fb_info *get_fb_info(struct fb_info *info)
> >> +__acquires(&info->lock)
> >> +{
> >> +	mutex_lock(&info->lock);
> >> +	if (!info->fbops) {
> >> +		mutex_unlock(&info->lock);
> >> +		return NULL;
> >> +	}
> >> +	return info;
> >> +}
> >> +
> >> +void put_fb_info(struct fb_info *info)
> >> +__releases(&info->lock)
> >> +{
> >> +	mutex_unlock(&info->lock);
> >> +}
> >> +
> > 
> > These are IMO bad function names.
> 
> PS:  The return value of the mutex_lock wrapper is also bad.  A bool or
> int would IMO be clearer, similar to the return value of mutex_trylock.

That, and there is no possible way to get the sparse annotations right
for that function, which means you'll get no help from sparse in lock
checking.

So I'd suggest just opencoding these where needed instead of the
wrappers.

Harvey


  reply	other threads:[~2009-01-19  8:10 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-01-17 23:19 .29rc2 lockdep report. fb_mmap vs sys_mmap2 Dave Jones
2009-01-18  2:00 ` Johannes Weiner
2009-01-18 19:21   ` Andrea Righi
2009-01-18 20:17   ` [PATCH] fbmem: fix copy_from/to_user() with mutex held Andrea Righi
2009-01-19  7:54     ` Johannes Weiner
2009-01-19  7:58     ` Stefan Richter
2009-01-19  8:05       ` Stefan Richter
2009-01-19  8:10         ` Harvey Harrison [this message]
2009-01-19  8:29           ` Andrea Righi

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=1232352639.5570.8.camel@brick \
    --to=harvey.harrison@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=davej@redhat.com \
    --cc=hannes@cmpxchg.org \
    --cc=hannes@saeurebad.de \
    --cc=krzysztof.h1@wp.pl \
    --cc=linux-kernel@vger.kernel.org \
    --cc=righi.andrea@gmail.com \
    --cc=stefanr@s5r6.in-berlin.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