* [PATCH 1/2] regmap: give users _choice_ to allow write access to debugfs
@ 2013-05-30 16:24 Vinod Koul
2013-05-30 16:24 ` [PATCH 2/2] regmap: fix return of uninitialized value Vinod Koul
2013-06-01 18:49 ` [PATCH 1/2] regmap: give users _choice_ to allow write access to debugfs Mark Brown
0 siblings, 2 replies; 4+ messages in thread
From: Vinod Koul @ 2013-05-30 16:24 UTC (permalink / raw)
To: linux-kernel; +Cc: broonie, Vinod Koul
is very handy is debug kernels and should _never_ be turned On in production
mode
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
---
drivers/base/regmap/Kconfig | 9 +++++++++
drivers/base/regmap/regmap-debugfs.c | 3 +--
2 files changed, 10 insertions(+), 2 deletions(-)
diff --git a/drivers/base/regmap/Kconfig b/drivers/base/regmap/Kconfig
index f0d3054..928d6e3 100644
--- a/drivers/base/regmap/Kconfig
+++ b/drivers/base/regmap/Kconfig
@@ -20,3 +20,12 @@ config REGMAP_MMIO
config REGMAP_IRQ
bool
+
+
+config REGMAP_ALLOW_WRITE_DEBUGFS
+ bool "Regmap write access to usermode"
+ default n
+ help
+ WARNING: This allows usermode to write to hardware registers. Writing
+ to stuff like PMICs is _never_ advised due to obvious side effects, use
+ at very extreme caution. Is helpful for debugging
diff --git a/drivers/base/regmap/regmap-debugfs.c b/drivers/base/regmap/regmap-debugfs.c
index 23b701f..7989052 100644
--- a/drivers/base/regmap/regmap-debugfs.c
+++ b/drivers/base/regmap/regmap-debugfs.c
@@ -248,8 +248,7 @@ static ssize_t regmap_map_read_file(struct file *file, char __user *user_buf,
count, ppos);
}
-#undef REGMAP_ALLOW_WRITE_DEBUGFS
-#ifdef REGMAP_ALLOW_WRITE_DEBUGFS
+#ifdef CONFIG_REGMAP_ALLOW_WRITE_DEBUGFS
/*
* This can be dangerous especially when we have clients such as
* PMICs, therefore don't provide any real compile time configuration option
--
1.7.0.4
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH 2/2] regmap: fix return of uninitialized value
2013-05-30 16:24 [PATCH 1/2] regmap: give users _choice_ to allow write access to debugfs Vinod Koul
@ 2013-05-30 16:24 ` Vinod Koul
2013-06-01 18:52 ` Mark Brown
2013-06-01 18:49 ` [PATCH 1/2] regmap: give users _choice_ to allow write access to debugfs Mark Brown
1 sibling, 1 reply; 4+ messages in thread
From: Vinod Koul @ 2013-05-30 16:24 UTC (permalink / raw)
To: linux-kernel; +Cc: broonie, Vinod Koul
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
---
drivers/base/regmap/regmap-debugfs.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/drivers/base/regmap/regmap-debugfs.c b/drivers/base/regmap/regmap-debugfs.c
index 7989052..1db02cd 100644
--- a/drivers/base/regmap/regmap-debugfs.c
+++ b/drivers/base/regmap/regmap-debugfs.c
@@ -80,7 +80,7 @@ static unsigned int regmap_debugfs_get_dump_start(struct regmap *map,
{
struct regmap_debugfs_off_cache *c = NULL;
loff_t p = 0;
- unsigned int i, ret;
+ unsigned int i, ret = 0;
unsigned int fpos_offset;
unsigned int reg_offset;
--
1.7.0.4
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH 1/2] regmap: give users _choice_ to allow write access to debugfs
2013-05-30 16:24 [PATCH 1/2] regmap: give users _choice_ to allow write access to debugfs Vinod Koul
2013-05-30 16:24 ` [PATCH 2/2] regmap: fix return of uninitialized value Vinod Koul
@ 2013-06-01 18:49 ` Mark Brown
1 sibling, 0 replies; 4+ messages in thread
From: Mark Brown @ 2013-06-01 18:49 UTC (permalink / raw)
To: Vinod Koul; +Cc: linux-kernel
[-- Attachment #1: Type: text/plain, Size: 578 bytes --]
On Thu, May 30, 2013 at 09:54:01PM +0530, Vinod Koul wrote:
> is very handy is debug kernels and should _never_ be turned On in production
> mode
No, I'm not going to apply this. Allowing users to randomly write to
devices could potentially lead to physical damage to the system and so
isn't something we want to for example see distros enabling by mistake,
and it's also a back door that people will happily use for working
around the kernel in ill conceived ways.
People who reasonably need this are edting their kernel anyway so
tweaking the in code define isn't onerous.
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH 2/2] regmap: fix return of uninitialized value
2013-05-30 16:24 ` [PATCH 2/2] regmap: fix return of uninitialized value Vinod Koul
@ 2013-06-01 18:52 ` Mark Brown
0 siblings, 0 replies; 4+ messages in thread
From: Mark Brown @ 2013-06-01 18:52 UTC (permalink / raw)
To: Vinod Koul; +Cc: linux-kernel
[-- Attachment #1: Type: text/plain, Size: 541 bytes --]
On Thu, May 30, 2013 at 09:54:02PM +0530, Vinod Koul wrote:
> struct regmap_debugfs_off_cache *c = NULL;
> loff_t p = 0;
> - unsigned int i, ret;
> + unsigned int i, ret = 0;
Two problems here. One is that we shouldn't mix initialised and
non-initialised declarations on one line and the other is that just
squashing a value in isn't a great fix for this sort of thing - it's
just shutting the warning up but perhaps the compiler has actually
spotted some control flow error and there's more wrong than just a
missing initialisation.
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2013-06-01 18:52 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-05-30 16:24 [PATCH 1/2] regmap: give users _choice_ to allow write access to debugfs Vinod Koul
2013-05-30 16:24 ` [PATCH 2/2] regmap: fix return of uninitialized value Vinod Koul
2013-06-01 18:52 ` Mark Brown
2013-06-01 18:49 ` [PATCH 1/2] regmap: give users _choice_ to allow write access to debugfs Mark Brown
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®