All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: mhiramat@kernel.org
Cc: kernel-janitors@vger.kernel.org
Subject: [bug report] fprobe: Add exit_handler support
Date: Tue, 22 Mar 2022 09:46:20 +0300	[thread overview]
Message-ID: <20220322064620.GA22331@kili> (raw)

Hello Masami Hiramatsu,

The patch 5b0ab78998e3: "fprobe: Add exit_handler support" from Mar
15, 2022, leads to the following Smatch static checker warning:

	kernel/trace/fprobe.c:155 fprobe_init_rethook()
	warn: struct type mismatch 'rethook_node vs fprobe_rethook_node'

kernel/trace/fprobe.c
    134 static int fprobe_init_rethook(struct fprobe *fp, int num)
    135 {
    136         int i, size;
    137 
    138         if (num < 0)
    139                 return -EINVAL;
    140 
    141         if (!fp->exit_handler) {
    142                 fp->rethook = NULL;
    143                 return 0;
    144         }
    145 
    146         /* Initialize rethook if needed */
    147         size = num * num_possible_cpus() * 2;
    148         if (size < 0)
    149                 return -E2BIG;
    150 
    151         fp->rethook = rethook_alloc((void *)fp, fprobe_exit_handler);
    152         for (i = 0; i < size; i++) {
    153                 struct rethook_node *node;
    154 
--> 155                 node = kzalloc(sizeof(struct fprobe_rethook_node), GFP_KERNEL);

It's hard to tell if we're deliberately allocating a larger struct or
whether it's accidental.

    156                 if (!node) {
    157                         rethook_free(fp->rethook);
    158                         fp->rethook = NULL;
    159                         return -ENOMEM;
    160                 }
    161                 rethook_add_node(fp->rethook, node);
    162         }
    163         return 0;
    164 }

regards,
dan carpenter

             reply	other threads:[~2022-03-22  6:46 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-22  6:46 Dan Carpenter [this message]
2022-03-22  7:08 ` [bug report] fprobe: Add exit_handler support Masami Hiramatsu

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=20220322064620.GA22331@kili \
    --to=dan.carpenter@oracle.com \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=mhiramat@kernel.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.