CID 49221 (#1 of 1): Identical code for different branches (IDENTICAL_BRANCHES)
identical_branches: The same code is executed when the condition p == NULL is true or false, because the code in the if-then branch and after the if statement is identical. Should the if statement be removed?
In aesXCBCmac fix (potential) out of bound write in padding.
CID 155904 (#1 of 1): Out-of-bounds write (OVERRUN)
7. overrun-local: Overrunning array of 16 bytes at byte offset 16 by dereferencing pointer p2++.
CID 155471 (#1 of 1): Buffer not null terminated (BUFFER_SIZE_WARNING)67.
buffer_size_warning: Calling strncpy with a maximum size argument of 256 bytes on destination array envcopy of size 256 bytes might leave the destination string unterminated.
CID 155910 (#1 of 1): Out-of-bounds access (OVERRUN)1.
overrun-buffer-val: Overrunning buffer pointed to by key of 7 bytes by passing it to a function which accesses it at byte offset 63.
OREAD and OWRITE are used as array indexes assuming that OREAD was zero
and OWRITE was one. Thus each related allocation reserved just 2 slot and
even Ep struct in usb.h reserved just 2 int for toggles.
Since OREAD is now 1 and OWRITE is 2 we have to allocate/reserve 3 slot
as long as we use them as array indexes (which we could change in the future).
Unfortunately this means we waste the index zero in those arrays that will
always be unused. This also means that, to loop in such arrays we must begin
with OREAD as index zero is always empty.
PRO-MEMORIA: if/when we introduce the walk() syscall, OSTAT might turn useless.
In that case we might remove it and thus consider to move back OREAD/OWRITE
to 0/1 respectively (which might or might not be a good idea, to be analyzed).
Some devices return useful info on specific file remove (eg #0/pid, #0/ppid...)
so we need a tool to get such info.
rm -e '#0/pid' '#0/ppid'
#0/pid 65
#0/ppid 59
In Plan9 the create syscall fallback on a open(OTRUNC) if the
path provided already exists. This is actually a common requirement
as most programs (editors, cat...) simply requires that a file is
there and is empty, and doesn't care overwriting existing contents
(note that this is particularily sensible with something like fossil).
In Jehanne the application is responsible of actually handle this
"file exists" error but libc provides ocreate() to mimic the Plan9
behaviour. Note that ocreate introduce a subtle race too: the path
is walked several times if the file exists, thus it could misbehave
on concurrent namespace changes. However I guess this is not going to
happen often enough to care now.
NOTE we will probably address this rare race too, with a more drammatic change
to syscalls: a new walk() syscall that will provide an unopen fd.