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
>Organization:
>Environment:
System: NetBSD jinx.noi.kre.to 8.99.17 NetBSD 8.99.17 (GENERIC) #1: Sat May 19 20:03:18 ICT 2018 kre%onyx.coe.psu.ac.th@localhost:/usr/obj/testing/amd64/sys/arch/amd64/compile/GENERIC amd64
Architecture: x86_64
Machine: amd64
>Description:
	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.

>How-To-Repeat:
	UTSL

>Fix:
	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