Try/catch for modules?
Maria Neptune
maria.elysse.n at gmail.com
Fri Oct 18 11:48:48 EDT 2019
Edsger Dijkstra will haunt is forever, it seems. Gotos are just a tool,
and this is one of the few places they're the best tool for the job. And
generally in-kernel the acceptable method is to not forget a null check, as
Valdis mentioned. It's cool to forget a null check on your own machine (who
among us hasn't?) but if you're contributing/shipping code you gotta know
that those pointers are good.
On Fri, Oct 18, 2019, 11:44 Martin Galvan <omgalvan.86 at gmail.com> wrote:
> El jue., 17 oct. 2019 a las 19:13, Valdis Klētnieks
> (<valdis.kletnieks at vt.edu>) escribió:
> >
> > For starters, the *correct* in-kernel way to deal with this is:
> > if (!ptr) {
> > printk("You blew it!\n");
> > goto you_blew_it;
> > }
>
> goto statements are harmful. In any case, what I meant was to have
> some sort of safety net to prevent exceptions (i.e. if I screw up and
> forget a NULL check) from panicking the system.
>
> > Also, "current PID" and "my module" aren't two things that can
> correspond....
>
> I don't understand what you mean by that. Module code (e.g. an ioctl)
> runs as some process. In the case of an ioctl, I'd assume it's the
> same PID of the user process.
>
> _______________________________________________
> Kernelnewbies mailing list
> Kernelnewbies at kernelnewbies.org
> https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20191018/db4f445e/attachment.html>
More information about the Kernelnewbies
mailing list