From: "Kars Mulder" <kerneldev@karsmulder.nl>
To: "Pavel Machek" <pavel@ucw.cz>
Cc: linux-kernel@vger.kernel.org,
"Kai-Heng Feng" <kai.heng.feng@canonical.com>,
"Greg Kroah-Hartman" <gregkh@linuxfoundation.org>
Subject: Re: Writing to a const pointer: is this supposed to happen?
Date: Wed, 24 Jun 2020 14:34:45 +0200 [thread overview]
Message-ID: <db0-5ef34880-ab-10c623c0@12577330> (raw)
In-Reply-To: <20200623195520.GA24965@duo.ucw.cz>
On Tuesday, June 23, 2020 21:55 CEST, Pavel Machek wrote:
> Odd, indeed... but not likely to cause immediate problems.
>
> You may want to cc relevant maintainers, or even run git
> blame and contact author.
Thank you for your response.
The code was written by Kai-Heng Feng, whom I shall CC. The code is
part of the usbcore module, which does not have a maintainer listed in
MAINTAINERS, but the patch and most other recent patches to usbcore
were signed off exclusively by Greg Kroah-Hartman, so I guess that
makes him the de facto maintainer? I'll CC him as well.
I'm not sure whether it is easy to read the previous messages of this
thread if you got CC'ed just now, so I'll repeat/paraphrase the
important part of my initial mail for your convenience:
> In the file drivers/usb/core/quirks.c, I noticed that the function
> quirks_param_set writes to a const pointer, and would like to check
> whether this is ok with the kernel programming practices. Here are
> the relevant lines from the function (several lines omitted):
>
> static int quirks_param_set(const char *val, const struct kernel_param *kp) {
> char *p, *field;
> for (i = 0, p = (char *)val; p && *p;) {
> field = strsep(&p, ":");
>
> In here a const pointer *val is cast into a non-const pointer and
> then written to by the function strsep, which replaces the first
> occurrence of the ':' token with a null-byte. Is this allowed?
CC: Kai-Heng Feng <kai.heng.feng@canonical.com>
CC: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
next prev parent reply other threads:[~2020-06-24 12:35 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-06-22 11:35 Writing to a const pointer: is this supposed to happen? Kars Mulder
2020-06-23 19:55 ` Pavel Machek
2020-06-24 12:34 ` Kars Mulder [this message]
2020-06-24 13:10 ` Greg Kroah-Hartman
2020-06-24 15:25 ` Kars Mulder
2020-06-27 10:24 ` David Laight
2020-07-01 23:03 ` Kars Mulder
2020-07-02 7:55 ` David Laight
2020-07-02 21:48 ` Kars Mulder
2020-07-03 8:13 ` David Laight
2020-07-03 13:23 ` Kars Mulder
2020-07-04 11:55 ` Pavel Machek
2020-07-05 21:53 ` [PATCH] usb: core: fix quirks_param_set() writing to a const pointer Kars Mulder
2020-07-06 10:34 ` Greg Kroah-Hartman
2020-07-06 12:57 ` Kars Mulder
2020-07-06 13:07 ` Greg Kroah-Hartman
2020-07-06 13:58 ` Kars Mulder
[not found] <CAHp75Ve4O+OmVttjhtKepFWwZLU6tFMx5vNpPVJdB58mcLFm3w@mail.gmail.com>
2020-07-04 20:32 ` Writing to a const pointer: is this supposed to happen? Kars Mulder
2020-07-04 20:54 ` Andy Shevchenko
2020-07-05 18:27 ` Kars Mulder
[not found] <CAHp75Vf9ygQ++DL4ETMy54d=x6oS1qqHLhfyh58f7JCVvM17yA@mail.gmail.com>
2020-07-05 19:38 ` Kars Mulder
[not found] <CAHp75Ve3m=UK9r2o8bDotQWQBLz-fV8CO_VcTmWjdLW1p5wE-w@mail.gmail.com>
2020-07-05 20:48 ` Kars Mulder
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=db0-5ef34880-ab-10c623c0@12577330 \
--to=kerneldev@karsmulder.nl \
--cc=gregkh@linuxfoundation.org \
--cc=kai.heng.feng@canonical.com \
--cc=linux-kernel@vger.kernel.org \
--cc=pavel@ucw.cz \
/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