public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Jean Delvare <khali@linux-fr.org>
To: Mikael Pettersson <mikpe@csd.uu.se>
Cc: marcelo.tosatti@cyclades.com, linux-kernel@vger.kernel.org
Subject: Re: [PATCH][2.4.28-pre3] I2C driver core gcc-3.4 fixes
Date: Sun, 12 Sep 2004 15:44:29 +0200	[thread overview]
Message-ID: <20040912154429.0f9b228b.khali@linux-fr.org> (raw)
In-Reply-To: <200409121125.i8CBPUNI015192@harpo.it.uu.se>

> This patch fixes gcc-3.4 cast-as-lvalue warnings in the 2.4.28-pre3
> kernel's I2C driver core. The i2c-core.c change is from the 2.6
> kernel, the i2c-proc.c changes are new since the 2.6 code is
> different.
> (...)
> --- linux-2.4.28-pre3/drivers/i2c/i2c-proc.c.~1~	2004-02-18 15:16:22.000000000 +0100
> +++ linux-2.4.28-pre3/drivers/i2c/i2c-proc.c	2004-09-12 01:56:20.000000000 +0200
> (...)
> @@ -287,7 +287,7 @@
>  			if(copy_to_user(buffer, BUF, buflen))
>  				return -EFAULT;
>  			curbufsize += buflen;
> -			(char *) buffer += buflen;
> +			buffer += buflen;
>  		}
>  	*lenp = curbufsize;
>  	filp->f_pos += curbufsize;

Looks like arithmetics on void* to me, so while removing a warning you
add a different one. Same for all other "fixes" later in the patch.

It doesn't look to me like you are fixing the code, only hiding the
warnings. I am not really confident you aren't breaking things while
doing this.

After a quick look at the code I'd say that the buffer-like parameters
involved should be declared as char* instead of void* in the first
place, which would effectively make all further casts unnecessary, and
still work exactly as before.

Thanks.

-- 
Jean "Khali" Delvare
http://khali.linux-fr.org/

  reply	other threads:[~2004-09-12 13:48 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-09-12 11:25 [PATCH][2.4.28-pre3] I2C driver core gcc-3.4 fixes Mikael Pettersson
2004-09-12 13:44 ` Jean Delvare [this message]
  -- strict thread matches above, loose matches on Subject: below --
2004-09-12 15:10 Mikael Pettersson
2004-09-12 15:43 ` Jean Delvare
2004-09-14 18:19   ` Marcelo Tosatti

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=20040912154429.0f9b228b.khali@linux-fr.org \
    --to=khali@linux-fr.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=marcelo.tosatti@cyclades.com \
    --cc=mikpe@csd.uu.se \
    /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