setjmp/lonjmp (was: vinum warning)
Joerg Sonnenberger
joerg at britannica.bec.de
Thu Feb 3 16:21:30 PST 2005
On Fri, Feb 04, 2005 at 10:30:47AM +1030, Greg 'groggy' Lehey wrote:
> > Well, I would call vinum_scandisk calling setjmp and afterwards
> > calling parse_config, which can itself call vinum_scandisk, at least
> > dangerous.
>
> On the contrary, that's the advantage. Under these circumstances
> you're building a large number of stack frames, and none of the
> intervening ones interest you.
Actually, quite the reverse happens. You still build all the
stack frames and you still have to pass all the way up. It seems
to be save because this code path doesn't longjmp itself. If it
would or the any caller could do so after calling vinum_scandisk,
the system goes havoc. To check this, you have to actually verify
all the functions and that's a lot of work. Beside, shouldn't the
code return directly after the status = EINVAL? After freeing the
buffer of course, but it should not continue like it currently
might do.
Joerg
More information about the Kernel
mailing list