NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

kern/53491: Bizarre definition of POWER_IOC_GET_TYPE_WITH_LOSSAGE

>Number:         53491
>Category:       kern
>Synopsis:       Bizarre definition of POWER_IOC_GET_TYPE_WITH_LOSSAGE
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    kern-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Wed Aug 01 16:10:00 +0000 2018
>Originator:     Robert Elz
>Release:        NetBSD 8.99.17
System: NetBSD 8.99.17 NetBSD 8.99.17 (GENERIC) #1: Sat May 19 20:03:18 ICT 2018 amd64
Architecture: x86_64
Machine: amd64
	In src/sys/power.h observe ...

#define POWER_IOC_GET_TYPE_WITH_LOSSAGE _IOR('P', 0, sizeof(struct power_type))

	which is almost certainly not doing what it intended
	(sizeof(sizeof...)) is going to be (sizeof(size_t))
	which is likely 4 or 8 or something, rather than the
	32 which the code clearly wants.

	The companion:

#define POWER_IOC_GET_TYPE      _IOR('P', 0, struct power_type)

	is defined properly.


	I'd just remove the stray "sizeof()" but I am not sure what
	this would do to binary compat, or if in fact this ioctl
	is ever actually used anywhere, so I will leave it for
	someone who has a clue in this area.

Home | Main Index | Thread Index | Old Index