From: Greg KH <gregkh@suse.de>
To: Hank Janssen <hjanssen@microsoft.com>
Cc: Nicolas Palix <npalix@diku.dk>,
"kernel-janitors@vger.kernel.org"
<kernel-janitors@vger.kernel.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH 4/4] Staging: hv: Fix warning by casting a (const void *) to (void *)
Date: Wed, 29 Jul 2009 13:44:09 -0700 [thread overview]
Message-ID: <20090729204409.GA3238@suse.de> (raw)
In-Reply-To: <8AFC7968D54FB448A30D8F38F259C56209A7E5D8@TK5EX14MBXC116.redmond.corp.microsoft.com>
On Wed, Jul 29, 2009 at 08:13:56PM +0000, Hank Janssen wrote:
>
> >On Wed, Jul 29, 2009 at 02:10:28PM +0200, Nicolas Palix wrote:
> >>
> >> Fix compilation warning by casting the const void *Buffer
> >> variable into a void *.
> >>
> >>>
> [....]
> >> Signed-off-by: Nicolas Palix <npalix@diku.dk>
> >> ---
> >> drivers/staging/hv/Channel.c | 2 +-
> >> 1 files changed, 1 insertions(+), 1 deletions(-)
> >>
> >> diff --git a/drivers/staging/hv/Channel.c b/drivers/staging/hv/Channel.c
> >> index 68f3442..854fa30 100644
> >> --- a/drivers/staging/hv/Channel.c
> >> +++ b/drivers/staging/hv/Channel.c
> >> @@ -787,7 +787,7 @@ VmbusChannelSendPacket(
> >> bufferList[0].Data = &desc;
> >> bufferList[0].Length = sizeof(VMPACKET_DESCRIPTOR);
> >>
> >> - bufferList[1].Data = Buffer;
> >> + bufferList[1].Data = (void *)Buffer;
> >
> >Yeah, I thought about doing this as well, but it's wrong. If this
> >buffer really isn't being modified, then the Data pointer needs to be
> >const.
> >
> >Or, if the Data pointer really is going to not be const, then the
> >function parameters need to be changed, but that means lots of code
> >needs to be changed.
> >
> >Hank, what do you think is the correct thing to do here?
> >
> >thanks,
> >
> >greg k-h
>
> I think both will work. At some point in the past for this design was
> To leave open the possibility for having the buffer modified. Right
> Now I am pretty sure that it does not get modified.
>
> I am not tied to using either void or const. What makes more sense, are
> The kernel guidelines that if it does not get modified to define it as const?
Yes.
But the best thing to do is the other suggestion, convert it to use the
real scatter-gather api, and not duplicate the functionality here. That
should solve this issue, right?
> The only thing about changing the API signature is that it does trickle into
> A bunch of changes (primarily in Channel.[ch], ChannelInterface.[ch] and RingBuffer.[ch])
Yeah, that's why I didn't think it was a good idea overall to do that.
Oh, the ringbuffer code will eventually need to get removed anyway, the
kernel already has such infrastructure, so it should be used instead.
thanks,
greg k-h
next prev parent reply other threads:[~2009-07-29 20:46 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-07-29 12:10 [PATCH 4/4] Staging: hv: Fix warning by casting a (const void *) to (void *) Nicolas Palix
2009-07-29 13:02 ` Greg KH
2009-07-29 20:13 ` Hank Janssen
2009-07-29 20:44 ` Greg KH [this message]
2009-07-29 13:03 ` Joe Perches
2009-07-29 13:08 ` Arnd Bergmann
2009-07-29 13:13 ` Greg KH
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=20090729204409.GA3238@suse.de \
--to=gregkh@suse.de \
--cc=hjanssen@microsoft.com \
--cc=kernel-janitors@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=npalix@diku.dk \
/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