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:   Fri, 31 Mar 2017 17:35:11 +0300
From:   Andy Shevchenko <andy.shevchenko@...il.com>
To:     Rob Herring <robh@...nel.org>
Cc:     Andrey Smirnov <andrew.smirnov@...il.com>,
        Chris Healy <cphealy@...il.com>,
        Guenter Roeck <linux@...ck-us.net>,
        "linux-serial@...r.kernel.org" <linux-serial@...r.kernel.org>,
        "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH v3] serdev: Add serdev_device_write subroutine

On Fri, Mar 31, 2017 at 4:22 PM, Rob Herring <robh@...nel.org> wrote:
> On Thu, Mar 30, 2017 at 5:00 PM, Andrey Smirnov
> <andrew.smirnov@...il.com> wrote:

>> +int serdev_device_write(struct serdev_device *serdev,
>> +                       const unsigned char *buf, size_t count,
>> +                       unsigned long timeout)
>>  {
>>         struct serdev_controller *ctrl = serdev->ctrl;
>> +       int ret;
>>
>> +       if (!ctrl || !ctrl->ops->write_buf ||
>> +           (timeout && !serdev->ops->write_wakeup))
>>                 return -EINVAL;
>>
>> +       mutex_lock(&serdev->write_lock);
>> +       do {
>> +               reinit_completion(&serdev->write_comp);
>> +
>> +               ret = ctrl->ops->write_buf(ctrl, buf, count);
>> +               if (ret < 0)
>> +                       break;
>> +
>> +               buf += ret;
>> +               count -= ret;
>> +
>> +       } while (count &&
>> +                (timeout = wait_for_completion_timeout(&serdev->write_comp,
>> +                                                       timeout)));
>
> Need to test for timeout < 0 here and return timeout when < 0.

It can't be the case since the variable is of unsigned type.

-- 
With Best Regards,
Andy Shevchenko

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ