Re: Try/catch for modules?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 





On Fri, Oct 18, 2019 at 4:44 PM Martin Galvan <omgalvan.86@xxxxxxxxx> wrote:
El jue., 17 oct. 2019 a las 19:13, Valdis Klētnieks
(<valdis.kletnieks@xxxxxx>) 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.

Why exactly are goto statements harmful?
Here is Linus's email about goto.
https://koblents.com/Ches/Links/Month-Mar-2013/20-Using-Goto-in-Linux-Kernel-Code/

> 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@xxxxxxxxxxxxxxxxx
https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


--
Thank you
Warm Regards
Anuz
_______________________________________________
Kernelnewbies mailing list
Kernelnewbies@xxxxxxxxxxxxxxxxx
https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies

[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]

  Powered by Linux