NetBSD-Bugs archive

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

kern/52760: Cannot parse VCE firware version in radeon_vce.c



>Number:         52760
>Category:       kern
>Synopsis:       Cannot parse VCE firware version in radeon_vce.c
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    kern-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sat Nov 25 01:00:00 +0000 2017
>Originator:     HITOSHI Osada
>Release:        NetBSD-current
>Organization:
>Environment:
NetBSD athlon5350 8.99.7 NetBSD 8.99.7 (ATHLON5350KMS) #0: Sun Nov 19 23:26:17 JST 2017  that@athlon5350:/tmp/obj/sys/arch/amd64/compile/ATHLON5350KMS amd64
>Description:
In sys/external/bsd/drm2/dist/drm/radeon/radeon_vce.c, scan_2dec_{u8,uint} is used for parsing VCE versions.
However scan_2dec_{u8,uint} cannot parse /libdata/firmware/radeon/BONAIRE_vce.bin firmware version(40.2.2).
>How-To-Repeat:
boot radeonkms-enabled netbsd with GCN radeon.
>Fix:
diff --git a/sys/external/bsd/drm2/dist/drm/radeon/radeon_vce.c b/sys/external/bsd/drm2/dist/drm/radeon/radeon_vce.c
index cf2ff610be..8fd9c766a1 100644
--- a/sys/external/bsd/drm2/dist/drm/radeon/radeon_vce.c
+++ b/sys/external/bsd/drm2/dist/drm/radeon/radeon_vce.c
@@ -52,8 +52,13 @@ scan_2dec_u8(const char **sp, char delim, uint8_t *u8p)
 
 	if (!isdigit((unsigned char)(c0 = *(*sp)++)))
 		return false;
-	if (!isdigit((unsigned char)(c1 = *(*sp)++)))
+	if (!isdigit((unsigned char)(c1 = *(*sp)++))) {
+		if (c1 == delim) {
+			*u8p = (c0 - '0');
+			return true;
+		}
 		return false;
+	}
 	if (*(*sp)++ != delim)
 		return false;
 
@@ -68,8 +73,13 @@ scan_2dec_uint(const char **sp, char delim, unsigned int *uintp)
 
 	if (!isdigit((unsigned char)(c0 = *(*sp)++)))
 		return false;
-	if (!isdigit((unsigned char)(c1 = *(*sp)++)))
+	if (!isdigit((unsigned char)(c1 = *(*sp)++))) {
+		if (c1 == delim) {
+			*uintp = (c0 - '0');
+			return true;
+		}
 		return false;
+	}
 	if (*(*sp)++ != delim)
 		return false;
 



Home | Main Index | Thread Index | Old Index