From: Takashi Iwai <tiwai@suse.de>
To: Dan Carpenter <dan.carpenter@oracle.com>
Cc: Vinod Koul <vinod.koul@linux.intel.com>,
alsa-devel@alsa-project.org, kernel-janitors@vger.kernel.org,
Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>,
Jesper Juhl <jj@chaosbits.net>,
Namarta Kohli <namartax.kohli@intel.com>
Subject: Re: [patch] ALSA: compress_core: fix open flags test in snd_compr_open()
Date: Tue, 11 Sep 2012 12:28:01 +0000 [thread overview]
Message-ID: <s5h8vcgrbfy.wl%tiwai@suse.de> (raw)
In-Reply-To: <20120911111243.GC22259@elgon.mountain>
At Tue, 11 Sep 2012 14:12:43 +0300,
Dan Carpenter wrote:
>
> O_RDONLY is zero so the original test (f->f_flags & O_RDONLY) is always
> false and it will never do compress capture. The test for O_WRONLY is
> also slightly off. The original test would consider "->flags > (O_WRONLY | O_RDWR)" as write only instead of rejecting it as invalid.
>
> I've also removed the pr_err() because that could flood dmesg.
>
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Applied now. Thanks.
Takashi
>
> diff --git a/sound/core/compress_offload.c b/sound/core/compress_offload.c
> index ec2118d..eb60cb8 100644
> --- a/sound/core/compress_offload.c
> +++ b/sound/core/compress_offload.c
> @@ -80,14 +80,12 @@ static int snd_compr_open(struct inode *inode, struct file *f)
> int maj = imajor(inode);
> int ret;
>
> - if (f->f_flags & O_WRONLY)
> + if ((f->f_flags & O_ACCMODE) = O_WRONLY)
> dirn = SND_COMPRESS_PLAYBACK;
> - else if (f->f_flags & O_RDONLY)
> + else if ((f->f_flags & O_ACCMODE) = O_RDONLY)
> dirn = SND_COMPRESS_CAPTURE;
> - else {
> - pr_err("invalid direction\n");
> + else
> return -EINVAL;
> - }
>
> if (maj = snd_major)
> compr = snd_lookup_minor_data(iminor(inode),
>
prev parent reply other threads:[~2012-09-11 12:28 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-09-11 11:12 [patch] ALSA: compress_core: fix open flags test in snd_compr_open() Dan Carpenter
2012-09-11 12:28 ` Takashi Iwai [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:
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=s5h8vcgrbfy.wl%tiwai@suse.de \
--to=tiwai@suse.de \
--cc=alsa-devel@alsa-project.org \
--cc=dan.carpenter@oracle.com \
--cc=jj@chaosbits.net \
--cc=kernel-janitors@vger.kernel.org \
--cc=namartax.kohli@intel.com \
--cc=pierre-louis.bossart@linux.intel.com \
--cc=vinod.koul@linux.intel.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