lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Sun, 29 Apr 2012 21:19:55 -0700
From:	Dmitry Torokhov <dmitry.torokhov@...il.com>
To:	Stephen Warren <swarren@...dotorg.org>
Cc:	linux-input@...r.kernel.org, Viresh Kumar <viresh.kumar@...com>,
	devicetree-discuss@...ts.ozlabs.org, linux-kernel@...r.kernel.org,
	Rob Herring <rob.herring@...xeda.com>,
	Rakesh Iyer <riyer@...dia.com>
Subject: Re: [PATCH 2/2] Input: matrix_keymap - wire up device tree support

On Thu, Apr 26, 2012 at 09:05:18AM -0600, Stephen Warren wrote:
> On 04/26/2012 02:19 AM, Dmitry Torokhov wrote:
> > When platform keymap is not supplied to matrix_keypad_build_keymap()
> > and device tree support is enabled, try locating specified property
> > and load keymap from it. If property name is not defined, try using
> > "linux,keymap".
> > 
> > Based on earlier patch by Viresh Kumar <viresh.kumar@...com>
> 
> I think this series looks mostly OK. A few comments below.
> 
> We don't actually have the KBC driver hooked up on any boards yet, so I
> can't actually test this yet.
> 
> How will the linux,fn-keymap handling work? It looks like this code is
> allocating a keymap data structure with one additional row to represent
> fn-not-pressed vs. fn-pressed.

No, it loads 2x rows (therefore giving you twice original keymap size).

> I assume this will work without issue
> even though the second half is not filled in. Won't this allow the
> linux,keymap property entries to pass validation "if (row >= rows)" for
> one more row than it should?

Maybe... I think we should revisit this when you actually have
linux,fn-keymap. Probably will need to export matrix_keypad_parse_

> 
> > diff --git a/drivers/input/keyboard/tegra-kbc.c b/drivers/input/keyboard/tegra-kbc.c
> 
> > +static int __devinit tegra_kbd_setup_keymap(struct tegra_kbc *kbc)
> > +{
> > +	const struct tegra_kbc_platform_data *pdata = kbc->pdata;
> > +	const struct matrix_keymap_data *keymap_data = pdata->keymap_data;
> > +	unsigned int keymap_rows = KBC_MAX_KEY;
> > +	int retval;
> > +
> > +	if (pdata->use_fn_map)
> > +		keymap_rows *= 2;
> > +
> > +	retval = matrix_keypad_build_keymap(keymap_data, NULL,
> > +					    keymap_rows, KBC_MAX_COL,
> > +					    kbc->keycode, kbc->idev);
> > +	if (retval == -ENOSYS || retval == -ENOENT) {
> 
> This is looking for ENOSYS or ENOENT, but ...

Maybe just change it to retval && retval != -EINVAL...

> 
> > diff --git a/drivers/input/matrix-keymap.c b/drivers/input/matrix-keymap.c
> 
> > +static int matrix_keypad_parse_of_keymap(const char *propname,
> 
> > +	if (!np)
> > +		return -ENODEV;
> 
> Here and ...

Hmm, -ENODEV is probably not good. Not sure if this should be -ENOENT,
-ENOSYS or -EINVAL.

> 
> > +	prop = of_get_property(np, propname, &proplen);
> > +	if (!prop) {
> > +		dev_err(dev, "OF: %s property not defined in %s\n",
> > +			propname, np->full_name);
> > +		return -ENODEV;
> 
> Here return ENODEV instead.

This indeed should be -ENOENT.

-- 
Dmitry
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ