devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Petr Kulhavy <petr-Qh/3xLP0EvwAvxtiuMwx3w@public.gmane.org>
To: devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	b-liu-l0cyMroinI0@public.gmane.org
Cc: robh+dt-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org,
	pawel.moll-5wv7dgnIgG8@public.gmane.org,
	mark.rutland-5wv7dgnIgG8@public.gmane.org,
	ijc+devicetree-KcIKpvwj1kUDXYZnReoRVg@public.gmane.org,
	galak-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org,
	petr-Qh/3xLP0EvwAvxtiuMwx3w@public.gmane.org,
	linux-usb-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	balbi-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org,
	sergei.shtylyov-M4DtvfQ/ZS1MRgGoP+s0PdBPR1lH4CV8@public.gmane.org
Subject: [PATCH 3/5 v10] usb: musb: core: added missing const qualifier to musb_hdrc_platform_data::config
Date: Fri, 11 Mar 2016 09:29:47 +0100	[thread overview]
Message-ID: <1457684989-13318-3-git-send-email-petr@barix.com> (raw)
In-Reply-To: <1457684989-13318-1-git-send-email-petr-Qh/3xLP0EvwAvxtiuMwx3w@public.gmane.org>

The musb_hdrc_platform_data::config was defined as a non-const pointer.
However some drivers (e.g. the ux500) set up this pointer to point to a
static structure, which is potentially dangerous. Since the musb core
uses the pointer in a read-only manner the const qualifier was added to
protect the content of the config.

Signed-off-by: Petr Kulhavy <petr-Qh/3xLP0EvwAvxtiuMwx3w@public.gmane.org>
Acked-by: Sergei Shtylyov <sergei.shtylyov-M4DtvfQ/ZS1MRgGoP+s0PdBPR1lH4CV8@public.gmane.org>
Signed-off-by: Bin Liu <b-liu-l0cyMroinI0@public.gmane.org>
---
v5: <initial>

v6:
 - whitespace formatting corrected

v7: <no change>
v8: <no change>
v9: <no change>
v10: <no change>

 drivers/usb/musb/musb_core.c | 2 +-
 drivers/usb/musb/musb_core.h | 2 +-
 include/linux/usb/musb.h     | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/usb/musb/musb_core.c b/drivers/usb/musb/musb_core.c
index 6a2d6d3..b0be1a9 100644
--- a/drivers/usb/musb/musb_core.c
+++ b/drivers/usb/musb/musb_core.c
@@ -1920,7 +1920,7 @@ static void musb_recover_from_babble(struct musb *musb)
  */
 
 static struct musb *allocate_instance(struct device *dev,
-		struct musb_hdrc_config *config, void __iomem *mbase)
+		const struct musb_hdrc_config *config, void __iomem *mbase)
 {
 	struct musb		*musb;
 	struct musb_hw_ep	*ep;
diff --git a/drivers/usb/musb/musb_core.h b/drivers/usb/musb/musb_core.h
index 3f7a325..a062185 100644
--- a/drivers/usb/musb/musb_core.h
+++ b/drivers/usb/musb/musb_core.h
@@ -438,7 +438,7 @@ struct musb {
 	 */
 	unsigned                double_buffer_not_ok:1;
 
-	struct musb_hdrc_config	*config;
+	const struct musb_hdrc_config *config;
 
 	int			xceiv_old_state;
 #ifdef CONFIG_DEBUG_FS
diff --git a/include/linux/usb/musb.h b/include/linux/usb/musb.h
index 96ddfb7..0b3da40 100644
--- a/include/linux/usb/musb.h
+++ b/include/linux/usb/musb.h
@@ -124,7 +124,7 @@ struct musb_hdrc_platform_data {
 	int		(*set_power)(int state);
 
 	/* MUSB configuration-specific details */
-	struct musb_hdrc_config	*config;
+	const struct musb_hdrc_config *config;
 
 	/* Architecture specific board data	*/
 	void		*board_data;
-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

  parent reply	other threads:[~2016-03-11  8:29 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-03-11  8:29 [PATCH 1/5 v10] dt/bindings: Add binding for the DA8xx MUSB driver Petr Kulhavy
     [not found] ` <1457684989-13318-1-git-send-email-petr-Qh/3xLP0EvwAvxtiuMwx3w@public.gmane.org>
2016-03-11  8:29   ` [PATCH 2/5 v10] usb: musb: core: added helper function for parsing DT Petr Kulhavy
2016-03-11  8:29   ` Petr Kulhavy [this message]
     [not found]     ` <1457684989-13318-3-git-send-email-petr-Qh/3xLP0EvwAvxtiuMwx3w@public.gmane.org>
2016-03-11 15:54       ` [PATCH 3/5 v10] usb: musb: core: added missing const qualifier to musb_hdrc_platform_data::config Bin Liu
2016-03-11  8:29   ` [PATCH 4/5 v10] ARM: davinci: defined missing CFGCHIP2_REFFREQ_* macros for MUSB PHY Petr Kulhavy
2016-03-11  8:29   ` [PATCH 5/5 v10] usb: musb: da8xx: Add DT support for the DA8xx driver Petr Kulhavy
     [not found]     ` <1457684989-13318-5-git-send-email-petr-Qh/3xLP0EvwAvxtiuMwx3w@public.gmane.org>
2016-03-11 11:22       ` Sergei Shtylyov
2016-03-11 11:24   ` [PATCH 1/5 v10] dt/bindings: Add binding for the DA8xx MUSB driver Sergei Shtylyov
2016-03-11 15:51   ` Bin Liu
2016-03-11 15:58     ` Petr Kulhavy
     [not found]       ` <56E2EB3C.6080602-Qh/3xLP0EvwAvxtiuMwx3w@public.gmane.org>
2016-03-11 16:06         ` Bin Liu
2016-03-11 16:21           ` Petr Kulhavy
     [not found]             ` <56E2F078.9020708-Qh/3xLP0EvwAvxtiuMwx3w@public.gmane.org>
2016-03-11 18:24               ` Sergei Shtylyov
     [not found]                 ` <56E30D43.9030508-M4DtvfQ/ZS1MRgGoP+s0PdBPR1lH4CV8@public.gmane.org>
2016-03-16 14:56                   ` Petr Kulhavy
2016-03-11 18:27     ` Sergei Shtylyov
     [not found]       ` <56E30E0B.7020203-M4DtvfQ/ZS1MRgGoP+s0PdBPR1lH4CV8@public.gmane.org>
2016-03-11 18:32         ` Bin Liu
2016-03-14  7:00   ` Felipe Balbi
     [not found]     ` <87fuvtbl26.fsf-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2016-03-15  2:07       ` David Lechner
     [not found]         ` <56E76E5A.5060801-nq/r/kbU++upp/zk7JDF2g@public.gmane.org>
2016-03-15  7:52           ` Felipe Balbi
2016-04-04  8:45           ` Petr Kulhavy
     [not found]             ` <57022992.4060008-Qh/3xLP0EvwAvxtiuMwx3w@public.gmane.org>
2016-04-04 16:25               ` David Lechner
2016-03-18 19:14   ` Rob Herring

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=1457684989-13318-3-git-send-email-petr@barix.com \
    --to=petr-qh/3xlp0evwavxtiumwx3w@public.gmane.org \
    --cc=b-liu-l0cyMroinI0@public.gmane.org \
    --cc=balbi-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org \
    --cc=devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=galak-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org \
    --cc=ijc+devicetree-KcIKpvwj1kUDXYZnReoRVg@public.gmane.org \
    --cc=linux-usb-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=mark.rutland-5wv7dgnIgG8@public.gmane.org \
    --cc=pawel.moll-5wv7dgnIgG8@public.gmane.org \
    --cc=robh+dt-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org \
    --cc=sergei.shtylyov-M4DtvfQ/ZS1MRgGoP+s0PdBPR1lH4CV8@public.gmane.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 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).