Module Name:    src
Committed By:   christos
Date:           Mon Dec 19 14:30:23 UTC 2016

Modified Files:
        src/lib/libc/arch/powerpc/string: bzero.S

Log Message:
PR/50228: Christian Groessler: fix bzero(ptr, 0) on ppc. Check for 0 length
before jumping to cb_memset like memset does.


To generate a diff of this commit:
cvs rdiff -u -r1.14 -r1.15 src/lib/libc/arch/powerpc/string/bzero.S

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/lib/libc/arch/powerpc/string/bzero.S
diff -u src/lib/libc/arch/powerpc/string/bzero.S:1.14 src/lib/libc/arch/powerpc/string/bzero.S:1.15
--- src/lib/libc/arch/powerpc/string/bzero.S:1.14	Thu Sep 12 11:36:15 2013
+++ src/lib/libc/arch/powerpc/string/bzero.S	Mon Dec 19 09:30:23 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: bzero.S,v 1.14 2013/09/12 15:36:15 joerg Exp $ */
+/*	$NetBSD: bzero.S,v 1.15 2016/12/19 14:30:23 christos Exp $ */
 
 /*-
  * Copyright (C) 2001	Martin J. Laubach <[email protected]>
@@ -32,7 +32,7 @@
 
 
 #if defined(LIBC_SCCS) && !defined(lint)
-__RCSID("$NetBSD: bzero.S,v 1.14 2013/09/12 15:36:15 joerg Exp $")
+__RCSID("$NetBSD: bzero.S,v 1.15 2016/12/19 14:30:23 christos Exp $")
 #endif /* LIBC_SCCS && !lint */
 
 #include "assym.h"
@@ -54,6 +54,8 @@ __RCSID("$NetBSD: bzero.S,v 1.14 2013/09
 		.align 4
 ENTRY(bzero)
 		li	r_val, 0		/* Value to stuff in */
+		cmplwi	%cr1, %r4, 0		/* Zero length? */
+		beqlr-	%cr1			/* Yes, do nothing */
 		b	cb_memset
 END(bzero)
 

Reply via email to