Mark Wielaard <mjw(a)redhat.com> writes:
> + return printf ("<buffer overrun>"), 0;
ehe, OK, I admit I didn't know you could do that with a return statement.
I assume it returns zero?
Yeah, that's just return EXPRESSION where the expression involves a
comma operator. Nothing magic about it. I admit this bit slipped my
attention, I didn't mean to push it. It's not exactly an example of
stylistical purity.
I would have added int *val as argument and let the function return
a
boolean or int to signal failure to read the int value.
Yeah, I didn't like how verbose it all became, but let's have it this
way.
> + if (descsz != 128)
> + return;
The magic value needs a comment. Should it be < 128 (to allow expansion
of the note content later?) Also don't you want to print some
error/unexpected message here?
All NT_SIGINFO notes are 128 bytes in size. If it isn't 128 bytes, it's
not NT_SIGINFO. That's the logic employed by the generic note item
decoder as well--if the length of the note doesn't match what we think
it should be, we don't decode.
But that makes sense for the item decoder, where you then proceed to
read random offsets supplied by the EBL backend. Here, we have our own
size checks. So I just dropped the condition.
> + printf (" si_signo:%d, si_errno:%d,
si_code:%d\n",
> + si_signo, si_errno, si_code);
Does it make sense to translate the si_code and si_node into something
human readable in the switch case below?
This is as human readable as it gets. PRSTATUS mentions these variables
as well. I see value in humanizing the other messages though: changed
them to "fault address", "sender PID" and "sender UID".
I'll post the updated patch set later today.
Thanks,
PM