Re: [PATCH] xfsprogs: fix wrong variable type in write_once function

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




On 11/9/17 8:06 PM, Zorro Lang wrote:
> On Thu, Nov 09, 2017 at 07:47:14PM -0600, Eric Sandeen wrote:
>> On 11/9/17 7:17 PM, Zorro Lang wrote:
>>> The 'Coverity Scan' found a problem in new write_once() function:
>>>
>>> 272             size_t bytes;
>>> 273             bytes = do_pwrite(file->fd, offset, count, count, pwritev2_flags);
>>>>>>     CID 1420710:  Control flow issues  (NO_EFFECT)
>>>>>>     This less-than-zero comparison of an unsigned value is never true. "bytes < 0UL".
>>> 274             if (bytes < 0)
>>> 275                     return -1;
>>>
>>> That's unreasonable. do_pwrite return 'ssize_t' type value,
>> An int, actually, right?
> Yeah, I mean the pwrite manpage defines:
> 
> ssize_t pwrite(int fd, const void *buf, size_t count, off_t offset);

yes, but you said "do_pwrite" - which does call pwrite (ssize_t), and
returns it through an int.  :)  hence the request for a bit more fixing.

-Eric
--
To unsubscribe from this list: send the line "unsubscribe linux-xfs" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [XFS Filesystem Development (older mail)]     [Linux Filesystem Development]     [Linux Audio Users]     [Yosemite Trails]     [Linux Kernel]     [Linux RAID]     [Linux SCSI]


  Powered by Linux