lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <4aa65ad6-5324-0a8c-0fa6-0d8e680f0706@redhat.com>
Date:   Thu, 6 Aug 2020 11:37:38 +0800
From:   Jason Wang <jasowang@...hat.com>
To:     "Michael S. Tsirkin" <mst@...hat.com>
Cc:     linux-kernel@...r.kernel.org,
        virtualization@...ts.linux-foundation.org
Subject: Re: [PATCH v2 03/24] virtio: allow __virtioXX, __leXX in config space


On 2020/8/5 下午7:45, Michael S. Tsirkin wrote:
>>>    #define virtio_cread(vdev, structname, member, ptr)			\
>>>    	do {								\
>>>    		might_sleep();						\
>>>    		/* Must match the member's type, and be integer */	\
>>> -		if (!typecheck(typeof((((structname*)0)->member)), *(ptr))) \
>>> +		if (!__virtio_typecheck(structname, member, *(ptr)))	\
>>>    			(*ptr) = 1;					\
>> A silly question,  compare to using set()/get() directly, what's the value
>> of the accessors macro here?
>>
>> Thanks
> get/set don't convert to the native endian, I guess that's why
> drivers use cread/cwrite. It is also nice that there's type
> safety, checking the correct integer width is used.


Yes, but this is simply because a macro is used here, how about just 
doing things similar like virtio_cread_bytes():

static inline void virtio_cread(struct virtio_device *vdev,
                       unsigned int offset,
                       void *buf, size_t len)


And do the endian conversion inside?

Thanks


>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ