[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <79101f00-e3ff-9dd0-7a05-760f8be1ff69@rasmusvillemoes.dk>
Date: Fri, 15 Nov 2019 08:44:12 +0100
From: Rasmus Villemoes <linux@...musvillemoes.dk>
To: Timur Tabi <timur@...nel.org>
Cc: Qiang Zhao <qiang.zhao@....com>, Li Yang <leoyang.li@....com>,
Christophe Leroy <christophe.leroy@....fr>,
linuxppc-dev@...ts.ozlabs.org,
linux-arm-kernel <linux-arm-kernel@...ts.infradead.org>,
lkml <linux-kernel@...r.kernel.org>,
Scott Wood <oss@...error.net>, netdev <netdev@...r.kernel.org>
Subject: Re: [PATCH v4 45/47] net/wan/fsl_ucc_hdlc: reject muram offsets above
64K
On 15/11/2019 05.41, Timur Tabi wrote:
> On Fri, Nov 8, 2019 at 7:04 AM Rasmus Villemoes
> <linux@...musvillemoes.dk> wrote:
>
>> diff --git a/drivers/net/wan/fsl_ucc_hdlc.c b/drivers/net/wan/fsl_ucc_hdlc.c
>> index 8d13586bb774..f029eaa7cfc0 100644
>> --- a/drivers/net/wan/fsl_ucc_hdlc.c
>> +++ b/drivers/net/wan/fsl_ucc_hdlc.c
>> @@ -245,6 +245,11 @@ static int uhdlc_init(struct ucc_hdlc_private *priv)
>> ret = -ENOMEM;
>> goto free_riptr;
>> }
>> + if (riptr != (u16)riptr || tiptr != (u16)tiptr) {
>
> "riptr/tiptr > U16_MAX" is clearer.
>
I can change it, sure, but it's a matter of taste. To me the above asks
"does the value change when it is truncated to a u16" which makes
perfect sense when the value is next used with iowrite16be(). Using a
comparison to U16_MAX takes more brain cycles for me, because I have to
think whether it should be > or >=, and are there some
signedness/integer promotion business interfering with that test.
Rasmus
Powered by blists - more mailing lists