From: Florian Tobias Schandinat <FlorianSchandinat@gmx.de>
To: Thiago Farina <tfransosi@gmail.com>
Cc: linux-kernel@vger.kernel.org, Joseph Chan <JosephChan@via.com.tw>,
linux-fbdev@vger.kernel.org
Subject: Re: [PATCH] drivers/video/via/viafbdev.c: Check return value of strict_strtoul().
Date: Sun, 05 Dec 2010 21:37:00 +0000 [thread overview]
Message-ID: <4CFC05FC.90909@gmx.de> (raw)
In-Reply-To: <0b32968e295b04d3ced937e2e17771ad1fd0f633.1291434520.git.tfransosi@gmail.com>
Hi,
Thiago Farina schrieb:
> This fix the following warnings:
You could have made my job easier by
(1) mentioning that the first and the second email you sent are different
(2) highlighting the difference
I think your patch is correct, but I just saw a huge patch series by Alexey
Dobriyan on the LKML with much more invasive changes in this area (basically
eliminating strict_strtoul). I'll keep your second email as a backup but won't
apply it now as it would conflict with the series which obsolates it anyway.
Thanks,
Florian Tobias Schandinat
>
> drivers/video/via/viafbdev.c:1144: warning: ignoring return value of ‘strict_strtoul’, declared with attribute warn_unused_result
> drivers/video/via/viafbdev.c:1214: warning: ignoring return value of ‘strict_strtoul’, declared with attribute warn_unused_result
> drivers/video/via/viafbdev.c:1272: warning: ignoring return value of ‘strict_strtoul’, declared with attribute warn_unused_result
> drivers/video/via/viafbdev.c:1311: warning: ignoring return value of ‘strict_strtoul’, declared with attribute warn_unused_result
> drivers/video/via/viafbdev.c:1380: warning: ignoring return value of ‘strict_strtoul’, declared with attribute warn_unused_result
> drivers/video/via/viafbdev.c:1417: warning: ignoring return value of ‘strict_strtoul’, declared with attribute warn_unused_result
>
> Signed-off-by: Thiago Farina <tfransosi@gmail.com>
> ---
> drivers/video/via/viafbdev.c | 40 +++++++++++++++++++++++++++++++++-------
> 1 files changed, 33 insertions(+), 7 deletions(-)
>
> diff --git a/drivers/video/via/viafbdev.c b/drivers/video/via/viafbdev.c
> index d298cfc..9a53ec3 100644
> --- a/drivers/video/via/viafbdev.c
> +++ b/drivers/video/via/viafbdev.c
> @@ -1131,6 +1131,8 @@ static ssize_t viafb_dvp0_proc_write(struct file *file,
> char buf[20], *value, *pbuf;
> u8 reg_val = 0;
> unsigned long length, i;
> + int ret;
> +
> if (count < 1)
> return -EINVAL;
> length = count > 20 ? 20 : count;
> @@ -1141,7 +1143,10 @@ static ssize_t viafb_dvp0_proc_write(struct file *file,
> for (i = 0; i < 3; i++) {
> value = strsep(&pbuf, " ");
> if (value != NULL) {
> - strict_strtoul(value, 0, (unsigned long *)®_val);
> + ret = strict_strtoul(value, 0, (unsigned long *)®_val);
> + if (ret < 0)
> + return ret;
> +
> DEBUG_MSG(KERN_INFO "DVP0:reg_val[%l]=:%x\n", i,
> reg_val);
> switch (i) {
> @@ -1201,6 +1206,8 @@ static ssize_t viafb_dvp1_proc_write(struct file *file,
> char buf[20], *value, *pbuf;
> u8 reg_val = 0;
> unsigned long length, i;
> + int ret;
> +
> if (count < 1)
> return -EINVAL;
> length = count > 20 ? 20 : count;
> @@ -1211,7 +1218,10 @@ static ssize_t viafb_dvp1_proc_write(struct file *file,
> for (i = 0; i < 3; i++) {
> value = strsep(&pbuf, " ");
> if (value != NULL) {
> - strict_strtoul(value, 0, (unsigned long *)®_val);
> + ret = strict_strtoul(value, 0, (unsigned long *)®_val);
> + if (ret < 0)
> + return ret;
> +
> switch (i) {
> case 0:
> viafb_write_reg_mask(CR9B, VIACR,
> @@ -1263,13 +1273,17 @@ static ssize_t viafb_dfph_proc_write(struct file *file,
> char buf[20];
> u8 reg_val = 0;
> unsigned long length;
> + int ret;
> +
> if (count < 1)
> return -EINVAL;
> length = count > 20 ? 20 : count;
> if (copy_from_user(&buf[0], buffer, length))
> return -EFAULT;
> buf[length - 1] = '\0'; /*Ensure end string */
> - strict_strtoul(&buf[0], 0, (unsigned long *)®_val);
> + ret = strict_strtoul(&buf[0], 0, (unsigned long *)®_val);
> + if (ret < 0)
> + return ret;
> viafb_write_reg_mask(CR97, VIACR, reg_val, 0x0f);
> return count;
> }
> @@ -1302,13 +1316,17 @@ static ssize_t viafb_dfpl_proc_write(struct file *file,
> char buf[20];
> u8 reg_val = 0;
> unsigned long length;
> + int ret;
> +
> if (count < 1)
> return -EINVAL;
> length = count > 20 ? 20 : count;
> if (copy_from_user(&buf[0], buffer, length))
> return -EFAULT;
> buf[length - 1] = '\0'; /*Ensure end string */
> - strict_strtoul(&buf[0], 0, (unsigned long *)®_val);
> + ret = strict_strtoul(&buf[0], 0, (unsigned long *)®_val);
> + if (ret < 0)
> + return ret;
> viafb_write_reg_mask(CR99, VIACR, reg_val, 0x0f);
> return count;
> }
> @@ -1365,6 +1383,8 @@ static ssize_t viafb_vt1636_proc_write(struct file *file,
> char buf[30], *value, *pbuf;
> struct IODATA reg_val;
> unsigned long length, i;
> + int ret;
> +
> if (count < 1)
> return -EINVAL;
> length = count > 30 ? 30 : count;
> @@ -1377,8 +1397,11 @@ static ssize_t viafb_vt1636_proc_write(struct file *file,
> for (i = 0; i < 2; i++) {
> value = strsep(&pbuf, " ");
> if (value != NULL) {
> - strict_strtoul(value, 0,
> - (unsigned long *)®_val.Data);
> + ret = strict_strtoul(value, 0,
> + (unsigned long *)®_val.Data);
> + if (ret < 0)
> + return ret;
> +
> switch (i) {
> case 0:
> reg_val.Index = 0x08;
> @@ -1414,8 +1437,11 @@ static ssize_t viafb_vt1636_proc_write(struct file *file,
> for (i = 0; i < 2; i++) {
> value = strsep(&pbuf, " ");
> if (value != NULL) {
> - strict_strtoul(value, 0,
> + ret = strict_strtoul(value, 0,
> (unsigned long *)®_val.Data);
> + if (ret < 0)
> + return ret;
> +
> switch (i) {
> case 0:
> reg_val.Index = 0x08;
WARNING: multiple messages have this Message-ID (diff)
From: Florian Tobias Schandinat <FlorianSchandinat@gmx.de>
To: Thiago Farina <tfransosi@gmail.com>
Cc: linux-kernel@vger.kernel.org, Joseph Chan <JosephChan@via.com.tw>,
linux-fbdev@vger.kernel.org
Subject: Re: [PATCH] drivers/video/via/viafbdev.c: Check return value of strict_strtoul().
Date: Sun, 05 Dec 2010 22:37:00 +0100 [thread overview]
Message-ID: <4CFC05FC.90909@gmx.de> (raw)
In-Reply-To: <0b32968e295b04d3ced937e2e17771ad1fd0f633.1291434520.git.tfransosi@gmail.com>
Hi,
Thiago Farina schrieb:
> This fix the following warnings:
You could have made my job easier by
(1) mentioning that the first and the second email you sent are different
(2) highlighting the difference
I think your patch is correct, but I just saw a huge patch series by Alexey
Dobriyan on the LKML with much more invasive changes in this area (basically
eliminating strict_strtoul). I'll keep your second email as a backup but won't
apply it now as it would conflict with the series which obsolates it anyway.
Thanks,
Florian Tobias Schandinat
>
> drivers/video/via/viafbdev.c:1144: warning: ignoring return value of ‘strict_strtoul’, declared with attribute warn_unused_result
> drivers/video/via/viafbdev.c:1214: warning: ignoring return value of ‘strict_strtoul’, declared with attribute warn_unused_result
> drivers/video/via/viafbdev.c:1272: warning: ignoring return value of ‘strict_strtoul’, declared with attribute warn_unused_result
> drivers/video/via/viafbdev.c:1311: warning: ignoring return value of ‘strict_strtoul’, declared with attribute warn_unused_result
> drivers/video/via/viafbdev.c:1380: warning: ignoring return value of ‘strict_strtoul’, declared with attribute warn_unused_result
> drivers/video/via/viafbdev.c:1417: warning: ignoring return value of ‘strict_strtoul’, declared with attribute warn_unused_result
>
> Signed-off-by: Thiago Farina <tfransosi@gmail.com>
> ---
> drivers/video/via/viafbdev.c | 40 +++++++++++++++++++++++++++++++++-------
> 1 files changed, 33 insertions(+), 7 deletions(-)
>
> diff --git a/drivers/video/via/viafbdev.c b/drivers/video/via/viafbdev.c
> index d298cfc..9a53ec3 100644
> --- a/drivers/video/via/viafbdev.c
> +++ b/drivers/video/via/viafbdev.c
> @@ -1131,6 +1131,8 @@ static ssize_t viafb_dvp0_proc_write(struct file *file,
> char buf[20], *value, *pbuf;
> u8 reg_val = 0;
> unsigned long length, i;
> + int ret;
> +
> if (count < 1)
> return -EINVAL;
> length = count > 20 ? 20 : count;
> @@ -1141,7 +1143,10 @@ static ssize_t viafb_dvp0_proc_write(struct file *file,
> for (i = 0; i < 3; i++) {
> value = strsep(&pbuf, " ");
> if (value != NULL) {
> - strict_strtoul(value, 0, (unsigned long *)®_val);
> + ret = strict_strtoul(value, 0, (unsigned long *)®_val);
> + if (ret < 0)
> + return ret;
> +
> DEBUG_MSG(KERN_INFO "DVP0:reg_val[%l]=:%x\n", i,
> reg_val);
> switch (i) {
> @@ -1201,6 +1206,8 @@ static ssize_t viafb_dvp1_proc_write(struct file *file,
> char buf[20], *value, *pbuf;
> u8 reg_val = 0;
> unsigned long length, i;
> + int ret;
> +
> if (count < 1)
> return -EINVAL;
> length = count > 20 ? 20 : count;
> @@ -1211,7 +1218,10 @@ static ssize_t viafb_dvp1_proc_write(struct file *file,
> for (i = 0; i < 3; i++) {
> value = strsep(&pbuf, " ");
> if (value != NULL) {
> - strict_strtoul(value, 0, (unsigned long *)®_val);
> + ret = strict_strtoul(value, 0, (unsigned long *)®_val);
> + if (ret < 0)
> + return ret;
> +
> switch (i) {
> case 0:
> viafb_write_reg_mask(CR9B, VIACR,
> @@ -1263,13 +1273,17 @@ static ssize_t viafb_dfph_proc_write(struct file *file,
> char buf[20];
> u8 reg_val = 0;
> unsigned long length;
> + int ret;
> +
> if (count < 1)
> return -EINVAL;
> length = count > 20 ? 20 : count;
> if (copy_from_user(&buf[0], buffer, length))
> return -EFAULT;
> buf[length - 1] = '\0'; /*Ensure end string */
> - strict_strtoul(&buf[0], 0, (unsigned long *)®_val);
> + ret = strict_strtoul(&buf[0], 0, (unsigned long *)®_val);
> + if (ret < 0)
> + return ret;
> viafb_write_reg_mask(CR97, VIACR, reg_val, 0x0f);
> return count;
> }
> @@ -1302,13 +1316,17 @@ static ssize_t viafb_dfpl_proc_write(struct file *file,
> char buf[20];
> u8 reg_val = 0;
> unsigned long length;
> + int ret;
> +
> if (count < 1)
> return -EINVAL;
> length = count > 20 ? 20 : count;
> if (copy_from_user(&buf[0], buffer, length))
> return -EFAULT;
> buf[length - 1] = '\0'; /*Ensure end string */
> - strict_strtoul(&buf[0], 0, (unsigned long *)®_val);
> + ret = strict_strtoul(&buf[0], 0, (unsigned long *)®_val);
> + if (ret < 0)
> + return ret;
> viafb_write_reg_mask(CR99, VIACR, reg_val, 0x0f);
> return count;
> }
> @@ -1365,6 +1383,8 @@ static ssize_t viafb_vt1636_proc_write(struct file *file,
> char buf[30], *value, *pbuf;
> struct IODATA reg_val;
> unsigned long length, i;
> + int ret;
> +
> if (count < 1)
> return -EINVAL;
> length = count > 30 ? 30 : count;
> @@ -1377,8 +1397,11 @@ static ssize_t viafb_vt1636_proc_write(struct file *file,
> for (i = 0; i < 2; i++) {
> value = strsep(&pbuf, " ");
> if (value != NULL) {
> - strict_strtoul(value, 0,
> - (unsigned long *)®_val.Data);
> + ret = strict_strtoul(value, 0,
> + (unsigned long *)®_val.Data);
> + if (ret < 0)
> + return ret;
> +
> switch (i) {
> case 0:
> reg_val.Index = 0x08;
> @@ -1414,8 +1437,11 @@ static ssize_t viafb_vt1636_proc_write(struct file *file,
> for (i = 0; i < 2; i++) {
> value = strsep(&pbuf, " ");
> if (value != NULL) {
> - strict_strtoul(value, 0,
> + ret = strict_strtoul(value, 0,
> (unsigned long *)®_val.Data);
> + if (ret < 0)
> + return ret;
> +
> switch (i) {
> case 0:
> reg_val.Index = 0x08;
next prev parent reply other threads:[~2010-12-05 21:37 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-12-04 3:38 [PATCH] drivers/video/via/viafbdev.c: Check return value of strict_strtoul() Thiago Farina
2010-12-04 3:38 ` Thiago Farina
2010-12-04 3:49 ` Thiago Farina
2010-12-04 3:49 ` Thiago Farina
2010-12-05 21:37 ` Florian Tobias Schandinat [this message]
2010-12-05 21:37 ` Florian Tobias Schandinat
2010-12-06 15:18 ` Alexey Dobriyan
2010-12-06 15:18 ` Alexey Dobriyan
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=4CFC05FC.90909@gmx.de \
--to=florianschandinat@gmx.de \
--cc=JosephChan@via.com.tw \
--cc=linux-fbdev@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=tfransosi@gmail.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 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.