<p>Marshall Dawson has uploaded this change for <strong>review</strong>.</p><p><a href="https://review.coreboot.org/20655">View Change</a></p><pre style="font-family: monospace,monospace; white-space: pre-wrap;">libpayload: Fix unaligned buffer logic in default_memset<br><br>Fix an issue when setting an unaligned buffer where n is less<br>than the difference of the rounded up pointer and the pointer.<br>This was identified where n=1 was passed.  n was decremented<br>once, as expected, then decremented again after the while()<br>evaluated to false.  This resulted in a new n of 4GB.<br><br>Change-Id: I862671bbe7efa8d370d0148e22ea55407e260053<br>Signed-off-by: Marshall Dawson <marshalldawson3rd@gmail.com><br>---<br>M payloads/libpayload/libc/memory.c<br>1 file changed, 3 insertions(+), 1 deletion(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">git pull ssh://review.coreboot.org:29418/coreboot refs/changes/55/20655/1</pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">diff --git a/payloads/libpayload/libc/memory.c b/payloads/libpayload/libc/memory.c<br>index 2c44764..8d0172c 100644<br>--- a/payloads/libpayload/libc/memory.c<br>+++ b/payloads/libpayload/libc/memory.c<br>@@ -41,8 +41,10 @@<br>       u8 *p = s;<br> <br>         s = (void *)ALIGN_UP((uintptr_t)s, sizeof(unsigned long));<br>-   while (p != (u8 *)s && n--)<br>+  while (p != (u8 *)s && n) {<br>           *p++ = c;<br>+            n--;<br>+ }<br> <br>  for (i = 1; i < sizeof(unsigned long); i <<= 1)<br>              w = (w << (i * 8)) | w;<br></pre><p>To view, visit <a href="https://review.coreboot.org/20655">change 20655</a>. To unsubscribe, visit <a href="https://review.coreboot.org/settings">settings</a>.</p><div itemscope itemtype="http://schema.org/EmailMessage"><div itemscope itemprop="action" itemtype="http://schema.org/ViewAction"><link itemprop="url" href="https://review.coreboot.org/20655"/><meta itemprop="name" content="View Change"/></div></div>

<div style="display:none"> Gerrit-Project: coreboot </div>
<div style="display:none"> Gerrit-Branch: master </div>
<div style="display:none"> Gerrit-MessageType: newchange </div>
<div style="display:none"> Gerrit-Change-Id: I862671bbe7efa8d370d0148e22ea55407e260053 </div>
<div style="display:none"> Gerrit-Change-Number: 20655 </div>
<div style="display:none"> Gerrit-PatchSet: 1 </div>
<div style="display:none"> Gerrit-Owner: Marshall Dawson <marshalldawson3rd@gmail.com> </div>