linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Joe Perches <joe@perches.com>
To: Christopher Heiny <cheiny@synaptics.com>
Cc: Dmitry Torokhov <dmitry.torokhov@gmail.com>,
	Jean Delvare <khali@linux-fr.org>,
	Linux Kernel <linux-kernel@vger.kernel.org>,
	Linux Input <linux-input@vger.kernel.org>,
	Allie Xiong <axiong@synaptics.com>, Vivian Ly <vly@synaptics.com>,
	Daniel Rosenberg <daniel.rosenberg@synaptics.com>,
	Alexandra Chen <alexandra.chen@tw.synaptics.com>,
	Joerie de Gram <j.de.gram@gmail.com>,
	Wolfram Sang <w.sang@pengutronix.de>,
	Mathieu Poirier <mathieu.poirier@linaro.org>,
	Linus Walleij <linus.walleij@stericsson.com>,
	Naveen Kumar Gaddipati <naveen.gaddipati@stericsson.com>
Subject: Re: [RFC PATCH 02/06] input/rmi4: Core files
Date: Sat, 06 Oct 2012 05:19:42 -0700	[thread overview]
Message-ID: <1349525982.2008.86.camel@joe-AO722> (raw)
In-Reply-To: <1349496603-20775-3-git-send-email-cheiny@synaptics.com>

On Fri, 2012-10-05 at 21:09 -0700, Christopher Heiny wrote:
[]

Just some trivial comments:

> diff --git a/drivers/input/rmi4/rmi_driver.c b/drivers/input/rmi4/rmi_driver.c
[]
> @@ -0,0 +1,1529 @@
[]
> +static ssize_t delay_write(struct file *filp, const char __user *buffer,
> +			   size_t size, loff_t *offset) {
> +	struct driver_debugfs_data *data = filp->private_data;
> +	struct rmi_device_platform_data *pdata =
> +			data->rmi_dev->phys->dev->platform_data;
> +	int retval;
> +	char local_buf[size];
> +	unsigned int new_read_delay;
> +	unsigned int new_write_delay;
> +	unsigned int new_block_delay;
> +	unsigned int new_pre_delay;
> +	unsigned int new_post_delay;
> +
> +	retval = copy_from_user(local_buf, buffer, size);
> +	if (retval)
> +		return -EFAULT;
> +
> +	retval = sscanf(local_buf, "%u %u %u %u %u", &new_read_delay,
> +			&new_write_delay, &new_block_delay,
> +			&new_pre_delay, &new_post_delay);
> +	if (retval != 5) {
> +		dev_err(&data->rmi_dev->dev,
> +			"Incorrect number of values provided for delay.");
> +		return -EINVAL;
> +	}
> +	if (new_read_delay < 0) {

These are unnecessary tests as unsigned values are never < 0.

> +		dev_err(&data->rmi_dev->dev,
> +			"Byte delay must be positive microseconds.\n");
> +		return -EINVAL;
> +	}
> +	if (new_write_delay < 0) {

etc.

> +static ssize_t phys_read(struct file *filp, char __user *buffer, size_t size,
> +		    loff_t *offset) {
> +	struct driver_debugfs_data *data = filp->private_data;
> +	struct rmi_phys_info *info = &data->rmi_dev->phys->info;
> +	int retval;
> +	char local_buf[size];

size comes from where?  possible stack overflow?

> +static ssize_t irq_debug_write(struct file *filp, const char __user *buffer,
> +			   size_t size, loff_t *offset) {
> +	int retval;
> +	char local_buf[size];

here too

[]

> +static int process_interrupt_requests(struct rmi_device *rmi_dev)
> +{
[]
> +	list_for_each_entry(entry, &data->rmi_functions.list, list)
> +		if (entry->irq_mask)
> +			process_one_interrupt(entry, irq_status,
> +					      data);

style nit, it'd be nicer with braces.

> diff --git a/drivers/input/rmi4/rmi_driver.h b/drivers/input/rmi4/rmi_driver.h
[]
> @@ -0,0 +1,438 @@

> +
> +#define tricat(x, y, z) tricat_(x, y, z)
> +
> +#define tricat_(x, y, z) x##y##z

I think these tricat macros are merely obfuscating
and don't need to be used.



  reply	other threads:[~2012-10-06 12:19 UTC|newest]

Thread overview: 54+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-10-06  4:09 [RFC PATCH 00/06] input: Synaptics RMI4 Touchscreen Driver Christopher Heiny
2012-10-06  4:09 ` [RFC PATCH 01/06] input/rmi4: Public header and documentation Christopher Heiny
2012-10-09  7:43   ` Linus Walleij
2012-10-09  8:27     ` Mark Brown
2012-10-11  3:56       ` Christopher Heiny
2012-10-12  5:16         ` Mark Brown
2012-10-23 22:10           ` Christopher Heiny
2012-10-24 17:49             ` Mark Brown
2012-10-11  3:41     ` Christopher Heiny
2012-10-11  8:24       ` Dmitry Torokhov
2012-10-23 22:55         ` Christopher Heiny
2012-10-11 15:22       ` Linus Walleij
2012-10-11 15:32       ` Linus Walleij
2012-10-16  6:26         ` Mark Brown
2012-10-23 23:19           ` Christopher Heiny
2012-10-23 23:18         ` Christopher Heiny
2012-10-11  8:20   ` Dmitry Torokhov
2012-10-23 22:39     ` Christopher Heiny
2012-10-23 22:47       ` Dmitry Torokhov
2012-10-06  4:09 ` [RFC PATCH 02/06] input/rmi4: Core files Christopher Heiny
2012-10-06 12:19   ` Joe Perches [this message]
2012-10-06 13:06     ` devendra.aaru
2012-10-06 13:08       ` devendra.aaru
2012-10-11  2:49     ` Christopher Heiny
2012-10-11  3:06       ` Joe Perches
2012-10-22 21:58         ` Christopher Heiny
2012-10-09  8:40   ` Linus Walleij
2012-10-11  4:15     ` Christopher Heiny
2012-10-11  8:13       ` Dmitry Torokhov
2012-10-23 23:46         ` Christopher Heiny
2012-10-24  0:11           ` Dmitry Torokhov
2012-10-24  0:32             ` Christopher Heiny
2012-10-11 15:37       ` Linus Walleij
2012-10-06  4:10 ` [RFC PATCH 03/06] input/rmi4: I2C physical interface Christopher Heiny
2012-10-09  9:05   ` Linus Walleij
2012-10-11  4:21     ` Christopher Heiny
2012-10-06  4:10 ` [RFC PATCH 04/06] input/rmi4: Config files and makefiles Christopher Heiny
2012-10-09  9:08   ` Linus Walleij
2012-10-11  4:23     ` Christopher Heiny
2012-10-06  4:10 ` [RFC PATCH 05/06] input/rmi4: F01 - device control Christopher Heiny
2012-10-09  9:31   ` Linus Walleij
2012-10-11  4:34     ` Christopher Heiny
2012-10-06  4:10 ` [RFC PATCH 06/06] input/rmi4: F11 - 2D touch interface Christopher Heiny
2012-10-09 10:02   ` Linus Walleij
2012-10-11  4:46     ` Christopher Heiny
2012-10-10 18:21   ` Henrik Rydberg
2012-10-25 21:39     ` Christopher Heiny
2012-11-17  3:58 [RFC PATCH 00/06] input: Synaptics RMI4 Touchscreen Driver Christopher Heiny
2012-11-17  3:58 ` [RFC PATCH 02/06] input/rmi4: Core files Christopher Heiny
2012-11-17 21:54   ` Greg Kroah-Hartman
2012-11-20  4:56     ` Christopher Heiny
2012-11-17 22:45   ` Linus Walleij
2012-11-26 18:41   ` Benjamin Tissoires
2012-11-26 22:54     ` Christopher Heiny
2012-11-27  9:33       ` Benjamin Tissoires

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=1349525982.2008.86.camel@joe-AO722 \
    --to=joe@perches.com \
    --cc=alexandra.chen@tw.synaptics.com \
    --cc=axiong@synaptics.com \
    --cc=cheiny@synaptics.com \
    --cc=daniel.rosenberg@synaptics.com \
    --cc=dmitry.torokhov@gmail.com \
    --cc=j.de.gram@gmail.com \
    --cc=khali@linux-fr.org \
    --cc=linus.walleij@stericsson.com \
    --cc=linux-input@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mathieu.poirier@linaro.org \
    --cc=naveen.gaddipati@stericsson.com \
    --cc=vly@synaptics.com \
    --cc=w.sang@pengutronix.de \
    /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).