mirror of
https://github.com/rwinkhart/sys.git
synced 2026-09-02 23:27:31 -04:00
unix: convert major/minor to uint64 before shifting in Mkdev on Darwin/*BSD
Follow CL 63090 and change the Makedev function on Darwin and *BSD to convert to uint64 before shifting/masking. This avoids a potential overflow. Change-Id: I5b566329695cc5edcf82f0ff2366033011b0625b Reviewed-on: https://go-review.googlesource.com/63112 Reviewed-by: Ian Lance Taylor <iant@golang.org> Run-TryBot: Ian Lance Taylor <iant@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org>
This commit is contained in:
committed by
Ian Lance Taylor
parent
7a85bfad8b
commit
804a9fee62
@@ -26,5 +26,5 @@ func Minor(dev uint64) uint32 {
|
||||
// Mkdev returns a DragonFlyBSD device number generated from the given major and
|
||||
// minor components.
|
||||
func Mkdev(major, minor uint32) uint64 {
|
||||
return uint64((major << 8) | minor)
|
||||
return (uint64(major) << 8) | uint64(minor)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user