From: Vivien Didelot <vivien.didelot@savoirfairelinux.com>
To: Andrew Lunn <andrew@lunn.ch>
Cc: netdev <netdev@vger.kernel.org>, David <davem@davemloft.net>,
Guenter Roeck <linux@roeck-us.net>,
linux-kernel <linux-kernel@vger.kernel.org>,
kernel <kernel@savoirfairelinux.com>
Subject: Re: [PATCH 1/2] net: dsa: mv88e6xxx: add write access to debugfs regs file
Date: Wed, 8 Jul 2015 17:12:59 -0400 (EDT) [thread overview]
Message-ID: <268315096.110637.1436389979563.JavaMail.zimbra@savoirfairelinux.com> (raw)
In-Reply-To: <20150708205348.GH1357@lunn.ch>
Hi Andrew,
----- On Jul 8, 2015, at 4:53 PM, Andrew Lunn andrew@lunn.ch wrote:
> On Wed, Jul 08, 2015 at 04:36:18PM -0400, Vivien Didelot wrote:
>> Allow write access to the regs file in the debugfs interface, with the
>> following parameters:
>>
>> echo <name> <reg> <value> > regs
>>
>> Where "name" is the register name (as shown in the header row), "reg" is
>> the register address (as shown in the first column) and "value" is the
>> 16-bit value. e.g.:
>>
>> echo GLOBAL 1a 5550 > regs
>>
>> Signed-off-by: Vivien Didelot <vivien.didelot@savoirfairelinux.com>
>> ---
>> drivers/net/dsa/mv88e6xxx.c | 32 +++++++++++++++++++++++++++++++-
>> 1 file changed, 31 insertions(+), 1 deletion(-)
>>
>> diff --git a/drivers/net/dsa/mv88e6xxx.c b/drivers/net/dsa/mv88e6xxx.c
>> index 8c130c0..04e6eb6 100644
>> --- a/drivers/net/dsa/mv88e6xxx.c
>> +++ b/drivers/net/dsa/mv88e6xxx.c
>> @@ -1648,6 +1648,35 @@ static int mv88e6xxx_regs_show(struct seq_file *s, void
>> *p)
>> return 0;
>> }
>>
>> +static ssize_t mv88e6xxx_regs_write(struct file *file, const char __user *buf,
>> + size_t count, loff_t *ppos)
>> +{
>> + struct seq_file *s = file->private_data;
>> + struct dsa_switch *ds = s->private;
>> + struct mv88e6xxx_priv_state *ps = ds_to_priv(ds);
>> + char name[count];
>
> Is this safe? Is count somehow limited? If i was to echo 8K to the
> file would i not exceed the kernel stack space?
>
> Andrew
I thought it was. But maybe 32 is a better value here. I'll resend these
two patches with char name[32] instead, tomorrow.
Thanks for your time,
-v
prev parent reply other threads:[~2015-07-08 21:13 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-07-08 20:36 Vivien Didelot
2015-07-08 20:36 ` [PATCH 2/2] net: dsa: mv88e6xxx: add SERDES registers to debugfs Vivien Didelot
2015-07-08 21:08 ` Andrew Lunn
2015-07-08 20:53 ` [PATCH 1/2] net: dsa: mv88e6xxx: add write access to debugfs regs file Andrew Lunn
2015-07-08 21:12 ` Vivien Didelot [this message]
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=268315096.110637.1436389979563.JavaMail.zimbra@savoirfairelinux.com \
--to=vivien.didelot@savoirfairelinux.com \
--cc=andrew@lunn.ch \
--cc=davem@davemloft.net \
--cc=kernel@savoirfairelinux.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux@roeck-us.net \
--cc=netdev@vger.kernel.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
all inboxes | Powered by JetHome®