From: Jean Delvare <khali@linux-fr.org>
To: Dan Carpenter <error27@gmail.com>
Cc: Mauro Carvalho Chehab <mchehab@infradead.org>,
"Beholder Intl. Ltd. Dmitry Belimov" <d.belimov@gmail.com>,
hermann pitton <hermann-pitton@arcor.de>,
Douglas Schilling Landgraf <dougsland@redhat.com>,
linux-media@vger.kernel.org, kernel-janitors@vger.kernel.org
Subject: Re: [patch v2] video/saa7134: change dprintk() to i2cdprintk()
Date: Mon, 24 May 2010 18:04:23 +0000 [thread overview]
Message-ID: <20100524200423.537a2895@hyperion.delvare> (raw)
In-Reply-To: <20100524155936.GZ22515@bicker>
Hi Dan,
On Mon, 24 May 2010 17:59:36 +0200, Dan Carpenter wrote:
> The problem is that dprintk() dereferences "dev" which is null here.
> The i2cdprintk() uses "ir" so that's OK.
>
> Also removed a duplicated break statement.
Mixing two unrelated fixes in the same patch is a bad idea. Here, the
replacement of dprintk() with i2cdprintk() fixes a potential NULL
pointer dereference, this might be worth backporting to stable kernel
series. The double break, OTOH, can't cause any harm, it's a simple
clean-up. So separate patches would be preferable.
>
> Signed-off-by: Dan Carpenter <error27@gmail.com>
> ---
> v2: Jean Delvare suggested that I use i2cdprintk() instead of modifying
> dprintk().
>
> diff --git a/drivers/media/video/saa7134/saa7134-input.c b/drivers/media/video/saa7134/saa7134-input.c
> index e5565e2..7691bf2 100644
> --- a/drivers/media/video/saa7134/saa7134-input.c
> +++ b/drivers/media/video/saa7134/saa7134-input.c
> @@ -141,8 +141,8 @@ static int get_key_flydvb_trio(struct IR_i2c *ir, u32 *ir_key, u32 *ir_raw)
> struct saa7134_dev *dev = ir->c->adapter->algo_data;
>
> if (dev = NULL) {
> - dprintk("get_key_flydvb_trio: "
> - "gir->c->adapter->algo_data is NULL!\n");
> + i2cdprintk("get_key_flydvb_trio: "
> + "gir->c->adapter->algo_data is NULL!\n");
> return -EIO;
> }
>
> @@ -195,8 +195,8 @@ static int get_key_msi_tvanywhere_plus(struct IR_i2c *ir, u32 *ir_key,
> /* <dev> is needed to access GPIO. Used by the saa_readl macro. */
> struct saa7134_dev *dev = ir->c->adapter->algo_data;
> if (dev = NULL) {
> - dprintk("get_key_msi_tvanywhere_plus: "
> - "gir->c->adapter->algo_data is NULL!\n");
> + i2cdprintk("get_key_msi_tvanywhere_plus: "
> + "gir->c->adapter->algo_data is NULL!\n");
> return -EIO;
> }
>
> @@ -815,7 +815,6 @@ int saa7134_input_init1(struct saa7134_dev *dev)
> mask_keyup = 0x020000;
> polling = 50; /* ms */
> break;
> - break;
> }
> if (NULL = ir_codes) {
> printk("%s: Oops: IR config error [card=%d]\n",
Acked-by: Jean Delvare <khali@linux-fr.org>
--
Jean Delvare
WARNING: multiple messages have this Message-ID (diff)
From: Jean Delvare <khali@linux-fr.org>
To: Dan Carpenter <error27@gmail.com>
Cc: Mauro Carvalho Chehab <mchehab@infradead.org>,
"Beholder Intl. Ltd. Dmitry Belimov" <d.belimov@gmail.com>,
hermann pitton <hermann-pitton@arcor.de>,
Douglas Schilling Landgraf <dougsland@redhat.com>,
linux-media@vger.kernel.org, kernel-janitors@vger.kernel.org
Subject: Re: [patch v2] video/saa7134: change dprintk() to i2cdprintk()
Date: Mon, 24 May 2010 20:04:23 +0200 [thread overview]
Message-ID: <20100524200423.537a2895@hyperion.delvare> (raw)
In-Reply-To: <20100524155936.GZ22515@bicker>
Hi Dan,
On Mon, 24 May 2010 17:59:36 +0200, Dan Carpenter wrote:
> The problem is that dprintk() dereferences "dev" which is null here.
> The i2cdprintk() uses "ir" so that's OK.
>
> Also removed a duplicated break statement.
Mixing two unrelated fixes in the same patch is a bad idea. Here, the
replacement of dprintk() with i2cdprintk() fixes a potential NULL
pointer dereference, this might be worth backporting to stable kernel
series. The double break, OTOH, can't cause any harm, it's a simple
clean-up. So separate patches would be preferable.
>
> Signed-off-by: Dan Carpenter <error27@gmail.com>
> ---
> v2: Jean Delvare suggested that I use i2cdprintk() instead of modifying
> dprintk().
>
> diff --git a/drivers/media/video/saa7134/saa7134-input.c b/drivers/media/video/saa7134/saa7134-input.c
> index e5565e2..7691bf2 100644
> --- a/drivers/media/video/saa7134/saa7134-input.c
> +++ b/drivers/media/video/saa7134/saa7134-input.c
> @@ -141,8 +141,8 @@ static int get_key_flydvb_trio(struct IR_i2c *ir, u32 *ir_key, u32 *ir_raw)
> struct saa7134_dev *dev = ir->c->adapter->algo_data;
>
> if (dev == NULL) {
> - dprintk("get_key_flydvb_trio: "
> - "gir->c->adapter->algo_data is NULL!\n");
> + i2cdprintk("get_key_flydvb_trio: "
> + "gir->c->adapter->algo_data is NULL!\n");
> return -EIO;
> }
>
> @@ -195,8 +195,8 @@ static int get_key_msi_tvanywhere_plus(struct IR_i2c *ir, u32 *ir_key,
> /* <dev> is needed to access GPIO. Used by the saa_readl macro. */
> struct saa7134_dev *dev = ir->c->adapter->algo_data;
> if (dev == NULL) {
> - dprintk("get_key_msi_tvanywhere_plus: "
> - "gir->c->adapter->algo_data is NULL!\n");
> + i2cdprintk("get_key_msi_tvanywhere_plus: "
> + "gir->c->adapter->algo_data is NULL!\n");
> return -EIO;
> }
>
> @@ -815,7 +815,6 @@ int saa7134_input_init1(struct saa7134_dev *dev)
> mask_keyup = 0x020000;
> polling = 50; /* ms */
> break;
> - break;
> }
> if (NULL == ir_codes) {
> printk("%s: Oops: IR config error [card=%d]\n",
Acked-by: Jean Delvare <khali@linux-fr.org>
--
Jean Delvare
next prev parent reply other threads:[~2010-05-24 18:04 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-05-22 20:15 [patch] video/saa7134: potential null dereferences in debug code Dan Carpenter
2010-05-22 20:15 ` Dan Carpenter
2010-05-22 20:59 ` [patch] video/saa7134: potential null dereferences in debug Jean Delvare
2010-05-22 20:59 ` [patch] video/saa7134: potential null dereferences in debug code Jean Delvare
2010-05-24 15:59 ` [patch v2] video/saa7134: change dprintk() to i2cdprintk() Dan Carpenter
2010-05-24 15:59 ` Dan Carpenter
2010-05-24 18:04 ` Jean Delvare [this message]
2010-05-24 18:04 ` Jean Delvare
2010-05-29 4:29 ` [patch] video/saa7134: potential null dereferences in debug Mauro Carvalho Chehab
2010-05-29 4:29 ` [patch] video/saa7134: potential null dereferences in debug code Mauro Carvalho Chehab
2010-05-29 7:06 ` [patch] video/saa7134: potential null dereferences in debug Jean Delvare
2010-05-29 7:06 ` [patch] video/saa7134: potential null dereferences in debug code Jean Delvare
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=20100524200423.537a2895@hyperion.delvare \
--to=khali@linux-fr.org \
--cc=d.belimov@gmail.com \
--cc=dougsland@redhat.com \
--cc=error27@gmail.com \
--cc=hermann-pitton@arcor.de \
--cc=kernel-janitors@vger.kernel.org \
--cc=linux-media@vger.kernel.org \
--cc=mchehab@infradead.org \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.