[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <878s59rrn0.fsf@osv.gnss.ru>
Date: Fri, 23 Apr 2021 17:40:19 +0300
From: Sergey Organov <sorganov@...il.com>
To: Walter Harms <wharms@....de>
Cc: David Laight <David.Laight@...LAB.COM>,
'Dan Carpenter' <dan.carpenter@...cle.com>,
Joel Stanley <joel@....id.au>,
Andrew Jeffery <andrew@...id.au>,
"Chia-Wei, Wang" <chiawei_wang@...eedtech.com>,
Jae Hyun Yoo <jae.hyun.yoo@...el.com>,
"John Wang" <wangzhiqiang.bj@...edance.com>,
Brad Bishop <bradleyb@...ziesquirrel.com>,
Patrick Venture <venture@...gle.com>,
"Benjamin Fair" <benjaminfair@...gle.com>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Robert Lippert <rlippert@...gle.com>,
"linux-aspeed@...ts.ozlabs.org" <linux-aspeed@...ts.ozlabs.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
"kernel-janitors@...r.kernel.org" <kernel-janitors@...r.kernel.org>
Subject: Re: AW: [PATCH] soc: aspeed: fix a ternary sign expansion bug
Walter Harms <wharms@....de> writes:
> as indepentent observer,
> i would go for Dans solution:
>
> ret = kfifo_to_user();
> /* if an error occurs just return */
> if (ret)
> return ret;
>
> /* otherwise return the copied number of bytes */
>
> return copied;
>
> there is no need for any deeper language knowledge,
Yep, but this is not idiomatic C, so one looking at this code would
tend to convert it back to ternary, and the actual problem here is that
the type of 'copied' does not match the return type of the function.
-- Sergey Organov
Powered by blists - more mailing lists