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] [day] [month] [year] [list]
Date:	Mon, 22 Jul 2013 13:51:19 +0300
From:	Oleksandr Kravchenko <o.v.kravchenko@...ballogic.com>
To:	Jonathan Cameron <jic23@...nel.org>
Cc:	Lars-Peter Clausen <lars@...afoo.de>,
	Oleksandr Kravchenko <x0199363@...com>, jic23@....ac.uk,
	linux-iio@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] iio: core: Avoid double minus in sysfs output

Please ignore this patch for now. I'll rework it soon. It issues
warnings when compiling.

On Sat, Jul 20, 2013 at 12:06 AM, Jonathan Cameron <jic23@...nel.org> wrote:
> On 07/19/2013 07:15 AM, Oleksandr Kravchenko wrote:
>> On Thu, Jul 18, 2013 at 7:24 PM, Lars-Peter Clausen <lars@...afoo.de> wrote:
>>> On 07/18/2013 05:47 PM, Oleksandr Kravchenko wrote:
>>>> From: Oleksandr Kravchenko <o.v.kravchenko@...ballogic.com>
>>>>
>>>> This patch fixes the issue with double minus in output when
>>>> reading channels from sysfs for IIO_VAL_INT_PLUS_MICRO and
>>>> IIO_VAL_INT_PLUS_NANO cases. Until this patch if val and val2
>>>> both are negatives output string contains "--" before
>>>> digits. It is result of "-%d..." in sprintf() format.
>>>>
>>>
>>> Hm, this might be a bug in a driver that is triggering this. The idea is
>>> that val2 is only allowed to be negative if val is 0.
>>>
>>> - Lars
>>>
>> If I calculate val and val2 in next way:
>> *val = adc / 1000000;
>> *val2 = adc % 1000000;
>> both val and val2 could by negative. Do I have to check it in my driver?
>>
> I guess it is will happen occasionally.  In the c89 standard, module for a negative
> is implementation specific.  Anyone know if we can assume this will work in all cases
> within the kernel?



-- 
Oleksandr Kravchenko
GlobalLogic
P +380633213187
P +380994930248
www.globallogic.com

http://www.globallogic.com/email_disclaimer.txt
--
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