From: Dan Carpenter <error27@gmail.com>
To: Dongliang Mu <dzm91@hust.edu.cn>, Vicki Pfau <vi@endrift.com>,
kernel-janitors@vger.kernel.org
Cc: Dmitry Torokhov <dmitry.torokhov@gmail.com>,
Pavel Rojtberg <rojtberg@gmail.com>, Nate Yocom <nate@yocom.org>,
Mattijs Korpershoek <mkorpershoek@baylibre.com>,
John Butler <radon86dev@gmail.com>,
Matthias Benkmann <matthias.benkmann@gmail.com>,
Christopher Crockett <chaorace@gmail.com>,
Santosh De Massari <s.demassari@gmail.com>,
hust-os-kernel-patches@googlegroups.com,
syzbot+a3f758b8d8cb7e49afec@syzkaller.appspotmail.com,
"Pierre-Loup A. Griffais" <pgriffais@valvesoftware.com>,
linux-input@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] Input: xpad - fix GPF in xpad_probe
Date: Mon, 17 Apr 2023 13:42:21 +0300 [thread overview]
Message-ID: <011c00e7-c351-4331-8be4-1c184d5773e1@kili.mountain> (raw)
In-Reply-To: <c3e0823b-2b03-4dab-b7cb-a8bc5151f0b1@kili.mountain>
Btw, we should be thinking about how to detect these sorts of issues
using static analysis. Unfortunately, it's not as simple as saying
"We know this variable is NULL so don't dereference it." The problem
with that is that many times Smatch sees where a pointer is set to NULL
but not when it is assigned to a different value.
What we could do instead is say:
1) If a pointer is dereferenced and we know it is NULL then:
set_state_expr(my_id, expr, &suspicious);
2) If we set a pointer to non-NULL and it is marked as suspicious then
print a warning.
This would generate a warning for cases where we dereference a pointer
before it has been initialized.
It is not hard to write a Smatch check like this. The first draft
approach is only three functions long.
regards,
dan carpenter
next prev parent reply other threads:[~2023-04-17 10:44 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-04-14 12:55 [PATCH] Input: xpad - fix GPF in xpad_probe Dongliang Mu
2023-04-17 9:25 ` Dan Carpenter
[not found] ` <99794af0-7367-acff-357d-1cd4fa7f832e@hust.edu.cn>
2023-04-17 10:24 ` Vicki Pfau
[not found] ` <57577302-8d18-231f-062b-b1d262720943@hust.edu.cn>
2023-04-17 11:07 ` Vicki Pfau
2023-04-17 11:15 ` Dongliang Mu
2023-04-17 10:42 ` Dan Carpenter [this message]
2023-04-20 11:07 ` Dan Carpenter
2023-04-22 19:48 ` Dan Carpenter
2023-04-22 19:56 ` Dan Carpenter
2023-04-23 2:33 ` Dongliang Mu
2023-05-02 10:34 ` Dan Carpenter
-- strict thread matches above, loose matches on Subject: below --
2023-08-14 21:12 Claudia De-Massari
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=011c00e7-c351-4331-8be4-1c184d5773e1@kili.mountain \
--to=error27@gmail.com \
--cc=chaorace@gmail.com \
--cc=dmitry.torokhov@gmail.com \
--cc=dzm91@hust.edu.cn \
--cc=hust-os-kernel-patches@googlegroups.com \
--cc=kernel-janitors@vger.kernel.org \
--cc=linux-input@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=matthias.benkmann@gmail.com \
--cc=mkorpershoek@baylibre.com \
--cc=nate@yocom.org \
--cc=pgriffais@valvesoftware.com \
--cc=radon86dev@gmail.com \
--cc=rojtberg@gmail.com \
--cc=s.demassari@gmail.com \
--cc=syzbot+a3f758b8d8cb7e49afec@syzkaller.appspotmail.com \
--cc=vi@endrift.com \
/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