From: roel.kluin@gmail.com (Roel Kluin)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH] pxa: make index mfp unsigned in mfp_read() and write()
Date: Wed, 11 Nov 2009 17:05:46 +0100 [thread overview]
Message-ID: <4AFAE0DA.6040300@gmail.com> (raw)
When signed, it is possible in theory to pass a negative mfp,
and read/write outside the array bounds.
Signed-off-by: Roel Kluin <roel.kluin@gmail.com>
---
arch/arm/plat-pxa/include/plat/mfp.h | 4 ++--
arch/arm/plat-pxa/mfp.c | 4 ++--
2 files changed, 4 insertions(+), 4 deletions(-)
I did not observe the passing of a negative mfp anywhere so this
can be considered as a cleanup. Alternatively I could introduce
a `mfp < 0' check in mfp_{read,write} instead if desired.
diff --git a/arch/arm/plat-pxa/include/plat/mfp.h b/arch/arm/plat-pxa/include/plat/mfp.h
index 22086e6..0743f4a 100644
--- a/arch/arm/plat-pxa/include/plat/mfp.h
+++ b/arch/arm/plat-pxa/include/plat/mfp.h
@@ -458,8 +458,8 @@ void __init mfp_init_addr(struct mfp_addr_map *map);
* mfp_config_lpm() - configuring all low power MFPR registers for suspend
* mfp_config_run() - configuring all run time MFPR registers after resume
*/
-unsigned long mfp_read(int mfp);
-void mfp_write(int mfp, unsigned long mfpr_val);
+unsigned long mfp_read(unsigned mfp);
+void mfp_write(unsigned mfp, unsigned long mfpr_val);
void mfp_config(unsigned long *mfp_cfgs, int num);
void mfp_config_run(void);
void mfp_config_lpm(void);
diff --git a/arch/arm/plat-pxa/mfp.c b/arch/arm/plat-pxa/mfp.c
index 9405d03..c80d0db 100644
--- a/arch/arm/plat-pxa/mfp.c
+++ b/arch/arm/plat-pxa/mfp.c
@@ -203,7 +203,7 @@ void mfp_config(unsigned long *mfp_cfgs, int num)
spin_unlock_irqrestore(&mfp_spin_lock, flags);
}
-unsigned long mfp_read(int mfp)
+unsigned long mfp_read(unsigned mfp)
{
unsigned long val, flags;
@@ -216,7 +216,7 @@ unsigned long mfp_read(int mfp)
return val;
}
-void mfp_write(int mfp, unsigned long val)
+void mfp_write(unsigned mfp, unsigned long val)
{
unsigned long flags;
WARNING: multiple messages have this Message-ID (diff)
From: Roel Kluin <roel.kluin@gmail.com>
To: Russell King <linux@arm.linux.org.uk>,
linux-arm-kernel@lists.infradead.org,
Andrew Morton <akpm@linux-foundation.org>,
LKML <linux-kernel@vger.kernel.org>
Subject: [PATCH] pxa: make index mfp unsigned in mfp_read() and write()
Date: Wed, 11 Nov 2009 17:05:46 +0100 [thread overview]
Message-ID: <4AFAE0DA.6040300@gmail.com> (raw)
When signed, it is possible in theory to pass a negative mfp,
and read/write outside the array bounds.
Signed-off-by: Roel Kluin <roel.kluin@gmail.com>
---
arch/arm/plat-pxa/include/plat/mfp.h | 4 ++--
arch/arm/plat-pxa/mfp.c | 4 ++--
2 files changed, 4 insertions(+), 4 deletions(-)
I did not observe the passing of a negative mfp anywhere so this
can be considered as a cleanup. Alternatively I could introduce
a `mfp < 0' check in mfp_{read,write} instead if desired.
diff --git a/arch/arm/plat-pxa/include/plat/mfp.h b/arch/arm/plat-pxa/include/plat/mfp.h
index 22086e6..0743f4a 100644
--- a/arch/arm/plat-pxa/include/plat/mfp.h
+++ b/arch/arm/plat-pxa/include/plat/mfp.h
@@ -458,8 +458,8 @@ void __init mfp_init_addr(struct mfp_addr_map *map);
* mfp_config_lpm() - configuring all low power MFPR registers for suspend
* mfp_config_run() - configuring all run time MFPR registers after resume
*/
-unsigned long mfp_read(int mfp);
-void mfp_write(int mfp, unsigned long mfpr_val);
+unsigned long mfp_read(unsigned mfp);
+void mfp_write(unsigned mfp, unsigned long mfpr_val);
void mfp_config(unsigned long *mfp_cfgs, int num);
void mfp_config_run(void);
void mfp_config_lpm(void);
diff --git a/arch/arm/plat-pxa/mfp.c b/arch/arm/plat-pxa/mfp.c
index 9405d03..c80d0db 100644
--- a/arch/arm/plat-pxa/mfp.c
+++ b/arch/arm/plat-pxa/mfp.c
@@ -203,7 +203,7 @@ void mfp_config(unsigned long *mfp_cfgs, int num)
spin_unlock_irqrestore(&mfp_spin_lock, flags);
}
-unsigned long mfp_read(int mfp)
+unsigned long mfp_read(unsigned mfp)
{
unsigned long val, flags;
@@ -216,7 +216,7 @@ unsigned long mfp_read(int mfp)
return val;
}
-void mfp_write(int mfp, unsigned long val)
+void mfp_write(unsigned mfp, unsigned long val)
{
unsigned long flags;
next reply other threads:[~2009-11-11 16:05 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-11-11 16:05 Roel Kluin [this message]
2009-11-11 16:05 ` [PATCH] pxa: make index mfp unsigned in mfp_read() and write() Roel Kluin
2009-11-13 7:03 ` Eric Miao
2009-11-13 7:03 ` Eric Miao
2009-11-13 10:37 ` Roel Kluin
2009-11-13 10:37 ` Roel Kluin
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=4AFAE0DA.6040300@gmail.com \
--to=roel.kluin@gmail.com \
--cc=linux-arm-kernel@lists.infradead.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.