Re: setjmp/lonjmp (was: vinum warning)

看板DFBSD_kernel作者時間21年前 (2005/02/04 08:32), 編輯推噓0(000)
留言0則, 0人參與, 最新討論串8/11 (看更多)
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
文章代碼(AID): #120iAA00 (DFBSD_kernel)
討論串 (同標題文章)
文章代碼(AID): #120iAA00 (DFBSD_kernel)