Received: by 2002:a05:6a10:a841:0:0:0:0 with SMTP id d1csp1425503pxy; Fri, 23 Apr 2021 07:48:35 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx/0IMzcLSeWTUUryfI48YMDGz0CHHUKWemS0NC+6tZb6qrMTnPM4XisM4AYX59WOGCECnM X-Received: by 2002:a63:531b:: with SMTP id h27mr4119441pgb.395.1619189315783; Fri, 23 Apr 2021 07:48:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1619189315; cv=none; d=google.com; s=arc-20160816; b=QqZiJHBll82NEWMPZF9+FxeVwTwGyZvY+3iZ0zH1g/upoIiIrGr7gayimsJSF32hSK /sYntONjUC9qYKrJcZangmS4k2P/32eG74fchL644HmnsCJ64XC8fnH1KJicGAH/2uUw ZqTBGJ8RMnvqPUY7OQ7DGjinFOY0nHuNbTABaL+jz1DYMDqpH3H4C34BzWNq02i+l9tl gDaI1oybANT8F6IkmuC1CE1CKxOyKGi0zBUBRuZbKj8Cnomowt5/PWLb5OVql8lEM2BI 5ANKWbg4OUzn4bZSkyjMQvFq41cQmFWwO3XMA5ej0FE2dLhHLqEqUS/v0rLNOOMHsheu p6qQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:user-agent:message-id:in-reply-to :date:references:subject:cc:to:from; bh=DKbNh9qOeGlSkTfgJD58opfR2sYbEdGbL7AmJhcXZeg=; b=xMnfuQDYO8TCwc+wujwzEtp9ibR1Qp1WsxkKwxGmw1fGbS6gnbEvMAa7k6rM4U/1Lr SE2/5JgmTyPu5mw5s/HHzVM7PayihEwrhe6felYguJDTZ87R68He/Cv/N/WFd/TzzOXP de6woBFQXs8PqEBM+ratZ9+EFxxNAOe9algggBoTXqpX/XyIGtgrALbVjgSSFjHND24/ iQLM734/ngs6c59M4oO/9EzHY17Ll/0fgcwmNAgdLN7V0j+oO7kqWzhIBr89OwOEhTn0 0oaIrJdhCGnZvADkrCcl45Zq3Z5+GxAIks8JMkjhKoZL7tA+Gr/dl7N2zyB8pJS+gb4t LpGA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id z25si7703334pgu.175.2021.04.23.07.48.22; Fri, 23 Apr 2021 07:48:35 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231345AbhDWOs1 (ORCPT + 99 others); Fri, 23 Apr 2021 10:48:27 -0400 Received: from mail.javad.com ([54.86.164.124]:45868 "EHLO mail.javad.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229454AbhDWOs0 (ORCPT ); Fri, 23 Apr 2021 10:48:26 -0400 X-Greylist: delayed 449 seconds by postgrey-1.27 at vger.kernel.org; Fri, 23 Apr 2021 10:48:26 EDT Received: from osv (unknown [89.175.180.246]) by mail.javad.com (Postfix) with ESMTPSA id 905303E95C; Fri, 23 Apr 2021 14:40:20 +0000 (UTC) Received: from osv by osv with local (Exim 4.92) (envelope-from ) id 1lZwyh-0004QE-7K; Fri, 23 Apr 2021 17:40:19 +0300 From: Sergey Organov To: Walter Harms Cc: David Laight , 'Dan Carpenter' , Joel Stanley , Andrew Jeffery , "Chia-Wei, Wang" , Jae Hyun Yoo , "John Wang" , Brad Bishop , Patrick Venture , "Benjamin Fair" , Greg Kroah-Hartman , Robert Lippert , "linux-aspeed@lists.ozlabs.org" , "linux-kernel@vger.kernel.org" , "kernel-janitors@vger.kernel.org" Subject: Re: AW: [PATCH] soc: aspeed: fix a ternary sign expansion bug References: <59596244622c4a15ac8cc0747332d0be@AcuMS.aculab.com> <877dktuvmz.fsf@osv.gnss.ru> <265e2d3accc74c89b5bab22eadb43808@AcuMS.aculab.com> Date: Fri, 23 Apr 2021 17:40:19 +0300 In-Reply-To: (Walter Harms's message of "Fri, 23 Apr 2021 11:03:30 +0000") Message-ID: <878s59rrn0.fsf@osv.gnss.ru> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Walter Harms 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