<div dir="ltr"><div dir="ltr"><br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Fri, Oct 18, 2019 at 4:44 PM Martin Galvan <<a href="mailto:omgalvan.86@gmail.com">omgalvan.86@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">El jue., 17 oct. 2019 a las 19:13, Valdis Klētnieks<br>
(<<a href="mailto:valdis.kletnieks@vt.edu" target="_blank">valdis.kletnieks@vt.edu</a>>) escribió:<br>
><br>
> For starters, the *correct* in-kernel way to deal with this is:<br>
> if (!ptr) {<br>
> printk("You blew it!\n");<br>
> goto you_blew_it;<br>
> }<br>
<br>
goto statements are harmful. In any case, what I meant was to have<br>
some sort of safety net to prevent exceptions (i.e. if I screw up and<br>
forget a NULL check) from panicking the system.<br>
<br></blockquote><div>Why exactly are goto statements harmful?</div><div>Here is Linus's email about goto.<br></div><div><a href="https://koblents.com/Ches/Links/Month-Mar-2013/20-Using-Goto-in-Linux-Kernel-Code/">https://koblents.com/Ches/Links/Month-Mar-2013/20-Using-Goto-in-Linux-Kernel-Code/</a></div><div> <br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
> Also, "current PID" and "my module" aren't two things that can correspond....<br>
<br>
I don't understand what you mean by that. Module code (e.g. an ioctl)<br>
runs as some process. In the case of an ioctl, I'd assume it's the<br>
same PID of the user process.<br>
<br>
_______________________________________________<br>
Kernelnewbies mailing list<br>
<a href="mailto:Kernelnewbies@kernelnewbies.org" target="_blank">Kernelnewbies@kernelnewbies.org</a><br>
<a href="https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies" rel="noreferrer" target="_blank">https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies</a><br>
</blockquote></div><br clear="all"><br>-- <br><div dir="ltr" class="gmail_signature">Thank you <br>Warm Regards<br>Anuz<br></div></div>