kernelnewbies.kernelnewbies.org archive mirror
 help / color / mirror / Atom feed
From: Anuz Pratap Singh Tomar <chambilkethakur@gmail.com>
To: Martin Galvan <omgalvan.86@gmail.com>
Cc: "Valdis Klētnieks" <valdis.kletnieks@vt.edu>,
	kernelnewbies <kernelnewbies@kernelnewbies.org>
Subject: Re: Try/catch for modules?
Date: Fri, 18 Oct 2019 16:47:50 +0100	[thread overview]
Message-ID: <CAJnfX5vQKfzVweUCkQvo8Zp67Gmbgg6hGAU9vENG-mQji1dsbQ@mail.gmail.com> (raw)
In-Reply-To: <CAN19L9EF01s_yGwzNLtLp+3HYUxrHrt65XPEd0utvonLZAY8=g@mail.gmail.com>


[-- Attachment #1.1: Type: text/plain, Size: 1234 bytes --]

On Fri, Oct 18, 2019 at 4:44 PM Martin Galvan <omgalvan.86@gmail.com> wrote:

> El jue., 17 oct. 2019 a las 19:13, Valdis Klētnieks
> (<valdis.kletnieks@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.
>
> 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@kernelnewbies.org
> https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
>


-- 
Thank you
Warm Regards
Anuz

[-- Attachment #1.2: Type: text/html, Size: 2275 bytes --]

[-- Attachment #2: Type: text/plain, Size: 170 bytes --]

_______________________________________________
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies

  reply	other threads:[~2019-10-18 15:51 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-10-17 13:37 Try/catch for modules? Martin Galvan
     [not found] ` <CAG=DERmX7AU8YkEAYnPLfPKCLD=1OugmD95R9wZ3CepXvqzd2Q@mail.gmail.com>
2019-10-17 13:42   ` Maria Neptune
2019-10-17 13:51     ` Ruben Safir
2019-10-17 22:12 ` Valdis Klētnieks
2019-10-18 15:43   ` Martin Galvan
2019-10-18 15:47     ` Anuz Pratap Singh Tomar [this message]
2019-10-18 15:48     ` Maria Neptune
2019-10-18 16:04     ` Bernd Petrovitsch
2019-10-18 16:11       ` Martin Galvan
2019-10-18 16:18         ` Bernd Petrovitsch
2019-10-18 17:02         ` Ruben Safir
2019-10-18 17:05           ` Martin Galvan
2019-10-18 18:52             ` Ruben Safir
2019-10-18 18:53             ` Ruben Safir
2019-10-18 19:08               ` Ruben Safir
2019-10-18 21:53         ` Valdis Klētnieks
2019-10-18 22:09           ` Martin Galvan
2019-10-18 22:28             ` Greg KH
2019-10-18 18:48     ` Ruben Safir
2019-10-18 21:24     ` Rik van Riel
2019-10-18 21:32       ` Ruben Safir
2019-10-18 21:37       ` Ruben Safir
2019-10-18 22:59     ` Valdis Klētnieks
2019-10-19  7:46 ` Bjørn Mork

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAJnfX5vQKfzVweUCkQvo8Zp67Gmbgg6hGAU9vENG-mQji1dsbQ@mail.gmail.com \
    --to=chambilkethakur@gmail.com \
    --cc=kernelnewbies@kernelnewbies.org \
    --cc=omgalvan.86@gmail.com \
    --cc=valdis.kletnieks@vt.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).