Skip to content

Commit 69d4481

Browse files
committed
6l: fix datblk loop in asmb_elf: sizeof(buf) not sizeof(buf.dbuf)
buf.dbuf is char[1], so sizeof(buf.dbuf)=1. With Dbufslop=100 the step was 1-100=-99, which got passed as the write count to pwrite, causing "bad address in syscall". The correct size is sizeof(buf) (the full union), matching the existing asmb() data loop. https://claude.ai/code/session_01WGAwvvTwDg2yknFkmZ3qzs
1 parent a996a81 commit 69d4481

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

sys/src/cmd/6l/asm.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -275,9 +275,9 @@ asmb_elf(void)
275275
Bprint(&bso, "%5.2f asmb elf data\n", cputime());
276276
Bflush(&bso);
277277

278-
for(v = 0; v < datsize; v += sizeof(buf.dbuf) - Dbufslop) {
279-
if(datsize - v > sizeof(buf.dbuf) - Dbufslop)
280-
datblk(v, sizeof(buf.dbuf) - Dbufslop);
278+
for(v = 0; v < datsize; v += sizeof(buf) - Dbufslop) {
279+
if(datsize - v > sizeof(buf) - Dbufslop)
280+
datblk(v, sizeof(buf) - Dbufslop);
281281
else
282282
datblk(v, datsize - v);
283283
}

0 commit comments

Comments
 (0)