From: Matej Genci <matej.genci@nutanix.com>
To: Jason Wang <jasowang@redhat.com>,
"virtualization@lists.linux-foundation.org"
<virtualization@lists.linux-foundation.org>,
"mst@redhat.com" <mst@redhat.com>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] virtio: Change typecasts in vring_init()
Date: Fri, 30 Aug 2019 17:26:47 +0000 [thread overview]
Message-ID: <25df690f-0f0c-baf9-2a8f-392e46468b42@nutanix.com> (raw)
In-Reply-To: <e6aa7fa1-8f41-fc55-51b2-5f0052cfb2d0@redhat.com>
On 8/30/2019 4:48 AM, Jason Wang wrote:
>
> On 2019/8/27 下午11:20, Matej Genci wrote:
>> Compilers such as g++ 7.3 complain about assigning void* variable to
>> a non-void* variable (like struct pointers) and pointer arithmetics
>> on void*.
>>
>> Signed-off-by: Matej Genci <matej.genci@nutanix.com>
>> ---
>> include/uapi/linux/virtio_ring.h | 9 +++++----
>> 1 file changed, 5 insertions(+), 4 deletions(-)
>>
>> diff --git a/include/uapi/linux/virtio_ring.h b/include/uapi/linux/virtio_ring.h
>> index 4c4e24c291a5..2c339b9e2923 100644
>> --- a/include/uapi/linux/virtio_ring.h
>> +++ b/include/uapi/linux/virtio_ring.h
>> @@ -168,10 +168,11 @@ static inline void vring_init(struct vring *vr, unsigned int num, void *p,
>> unsigned long align)
>> {
>> vr->num = num;
>> - vr->desc = p;
>> - vr->avail = p + num*sizeof(struct vring_desc);
>> - vr->used = (void *)(((uintptr_t)&vr->avail->ring[num] + sizeof(__virtio16)
>> - + align-1) & ~(align - 1));
>> + vr->desc = (struct vring_desc *)p;
>> + vr->avail = (struct vring_avail *)((uintptr_t)p
>> + + num*sizeof(struct vring_desc));
>
>
> It's better to let the code pass checkpath.pl here.
>
It passes for me
--------8<--------
./scripts/checkpatch.pl 0001-virtio-Change-typecasts-in-vring_init.patch
total: 0 errors, 0 warnings, 15 lines checked
0001-virtio-Change-typecasts-in-vring_init.patch has no obvious style problems and is ready for submission.
--------8<--------
Is there something I'm missing?
> Other looks good.
>
> Thanks
>
>
>> + vr->used = (struct vring_used *)(((uintptr_t)&vr->avail->ring[num]
>> + + sizeof(__virtio16) + align-1) & ~(align - 1));
>> }
>>
>> static inline unsigned vring_size(unsigned int num, unsigned long align)
next prev parent reply other threads:[~2019-08-30 17:38 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-08-27 15:20 Matej Genci
2019-08-30 3:48 ` Jason Wang
2019-08-30 17:26 ` Matej Genci [this message]
2019-08-30 14:02 ` Michael S. Tsirkin
2019-08-30 17:58 ` Matej Genci
2019-08-31 17:43 ` Michael S. Tsirkin
2019-09-02 9:56 ` Matej Genci
2019-09-03 15:00 ` Michael S. Tsirkin
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=25df690f-0f0c-baf9-2a8f-392e46468b42@nutanix.com \
--to=matej.genci@nutanix.com \
--cc=jasowang@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mst@redhat.com \
--cc=virtualization@lists.linux-foundation.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®