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:	Tue, 24 May 2011 14:34:32 +0200
From:	Richard Cochran <richardcochran@...il.com>
To:	Nicolas Kaiser <nikai@...ai.net>
Cc:	Thomas Gleixner <tglx@...utronix.de>,
	Richard Cochran <richard.cochran@...cron.at>,
	linux-kernel@...r.kernel.org
Subject: Re: [PATCH] posix clocks: correct error value in posix_clock_poll()

On Tue, May 24, 2011 at 12:51:47PM +0200, Nicolas Kaiser wrote:
> Signed-off-by: Nicolas Kaiser <nikai@...ai.net>
> ---
> It looks to me like -ENODEV might not be a good return value
> in poll(). Would POLLERR be the correct one in this case?
> 
>  kernel/time/posix-clock.c |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
> 
> diff --git a/kernel/time/posix-clock.c b/kernel/time/posix-clock.c
> index c340ca6..2424d3f 100644
> --- a/kernel/time/posix-clock.c
> +++ b/kernel/time/posix-clock.c
> @@ -71,7 +71,7 @@ static unsigned int posix_clock_poll(struct file *fp, poll_table *wait)
>  	int result = 0;
>  
>  	if (!clk)
> -		return -ENODEV;
> +		return POLLERR;

The condition (!clk) is only satisfied when 'zombie' is set,
indicating that the dynamic clock has disappeared. That is why the
file operations uniformly return ENODEV. So, I think it makes sense
the way that it is.

In addition, man 2 poll says,

   POLLERR
          Error condition (output only).

so using that error code would be misleading, IMHO.

Thanks,
Richard
--
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