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:	Wed, 28 Oct 2015 14:41:35 +0000
From:	Nicholas Mc Guire <der.herr@...r.at>
To:	Jiri Slaby <jslaby@...e.cz>
Cc:	stable@...r.kernel.org, linux-kernel@...r.kernel.org,
	Nicholas Mc Guire <hofrat@...dl.org>,
	Hans de Goede <hdegoede@...hat.com>,
	Mauro Carvalho Chehab <mchehab@....samsung.com>,
	Oliver Neukum <ONeukum@...e.com>
Subject: Re: [PATCH 3.12 117/123] [media] gscpa_m5602: use msecs_to_jiffies
 for conversions

On Wed, Oct 28, 2015 at 02:53:48PM +0100, Jiri Slaby wrote:
> From: Nicholas Mc Guire <hofrat@...dl.org>
> 
> 3.12-stable review patch.  If anyone has any objections, please let me know.
> 
> ===============
> 
> commit 63f2f417526fc54191f2b813f72dc1d5322bede8 upstream.
> 
> API compliance scanning with coccinelle flagged:
> ./drivers/media/usb/gspca/m5602/m5602_s5k83a.c:180:9-25:
> 	 WARNING: timeout (100) seems HZ dependent
> 
> Numeric constants passed to schedule_timeout() make the effective
> timeout HZ dependent which makes little sense in a polling loop for
> the cameras rotation state.
> Fixed up by converting the constant to jiffies with msecs_to_jiffies()
> 
> Signed-off-by: Nicholas Mc Guire <hofrat@...dl.org>
> Signed-off-by: Hans de Goede <hdegoede@...hat.com>
> Signed-off-by: Mauro Carvalho Chehab <mchehab@....samsung.com>
> Cc: Oliver Neukum <ONeukum@...e.com>
> Signed-off-by: Jiri Slaby <jslaby@...e.cz>
> ---
>  drivers/media/usb/gspca/m5602/m5602_s5k83a.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/media/usb/gspca/m5602/m5602_s5k83a.c b/drivers/media/usb/gspca/m5602/m5602_s5k83a.c
> index 7cbc3a00bda8..bf6b215438e3 100644
> --- a/drivers/media/usb/gspca/m5602/m5602_s5k83a.c
> +++ b/drivers/media/usb/gspca/m5602/m5602_s5k83a.c
> @@ -177,7 +177,7 @@ static int rotation_thread_function(void *data)
>  	__s32 vflip, hflip;
>  
>  	set_current_state(TASK_INTERRUPTIBLE);
> -	while (!schedule_timeout(100)) {
> +	while (!schedule_timeout(msecs_to_jiffies(100))) {
>  		if (mutex_lock_interruptible(&sd->gspca_dev.usb_lock))
>  			break;
>

Note that there were some concerns regarding using msecs_to_jiffies
rather than explicit conversion where gcc can do constant folding
(so in this case something like (100 * HZ / 1000) this was mitigated by 
the following pathes to kbuild see
  https://lkml.org/lkml/2015/5/28/524
  https://lkml.org/lkml/2015/5/28/525

in this case this does not really apply as the numeric 100 is actually
a bug - but there might be some performance concerns if too many such
conversions are added (there were all together about 30 such cases).
 
thx!
hofrat 
--
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