Received: by 2002:a25:7ec1:0:0:0:0:0 with SMTP id z184csp4181711ybc; Thu, 14 Nov 2019 23:47:02 -0800 (PST) X-Google-Smtp-Source: APXvYqw1IirAjhQM1IghzzRHDbpiCla2uCuyXC23FhXZ9LPIZ6w+1FzXv355pL/umBxpWEjhTOZt X-Received: by 2002:a17:907:110f:: with SMTP id qu15mr11927963ejb.179.1573804022834; Thu, 14 Nov 2019 23:47:02 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1573804022; cv=none; d=google.com; s=arc-20160816; b=QrV/6Ftpy5L2BimrUQ2ekZ/saT1gdyU15omAxsZKNZ8oJPZYOdAFmTwSyNacKpMzHP RGy+ZteWyls5+InHsv0TbPerDD86c4kIucUkWa/KEqM4tXjEbBZNQDryOBHy65+bp43h sCFbipWHgjy1ZS99wSmsrkb7LKlkQoN/95CdQazcgP1RQtf9xHEqfydaDiC/VKx1vm0G JwezehL7bQzHpKIdokt+WN/tr6fbOT3WQt9xrAHQ1Do2c1XKgldaSWaPkaT/n+KNA78n D7WFYYNsd21vwsiI3mdKJdrQzEYjTpFV9/Vg5uYjfgKESZudwTLlSytGKU/UUsbGvqWJ wC0g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:dkim-signature; bh=MerzeYQd7mMrWj7xug82ip0Zzuk57QC86rO5mCSsEzs=; b=Npeuy4Nu6fwBHeRYMVc8bneggRWP+dn29O/KoKDPkvVjyAyL1TUF+Uum3pr0IbBg5m 6rxcwfLF5SIAe/BVz93Mll4nEydBdzijMY8hts/eX6Vlln3lw5wiNiiz2Ndxp87wNK0w Uidqis8Qu1MWG6GqJAaDAMoM8+I/g3izV8O9Y69wWip/WsjmKf31j1mJcbsAGm3yF5lV /AOqEPhzCZ2WuKVOG+/mOddAifPxLJ/CNLT3yQzBPf49y0QoqiD9G00Ds07t0aq5XTJC BSPVwXzB3IbyC6v3HshxJ/VmolB2SiUQxtcpGmi9lGzV/C+oTfJn3pG185pltdeYCgvg 37ZA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@rasmusvillemoes.dk header.s=google header.b=cimPOY7g; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f22si5563063eds.54.2019.11.14.23.46.37; Thu, 14 Nov 2019 23:47:02 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@rasmusvillemoes.dk header.s=google header.b=cimPOY7g; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727302AbfKOHoR (ORCPT + 99 others); Fri, 15 Nov 2019 02:44:17 -0500 Received: from mail-lj1-f195.google.com ([209.85.208.195]:46719 "EHLO mail-lj1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726786AbfKOHoQ (ORCPT ); Fri, 15 Nov 2019 02:44:16 -0500 Received: by mail-lj1-f195.google.com with SMTP id e9so9586225ljp.13 for ; Thu, 14 Nov 2019 23:44:14 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rasmusvillemoes.dk; s=google; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=MerzeYQd7mMrWj7xug82ip0Zzuk57QC86rO5mCSsEzs=; b=cimPOY7g4EAlwVyfr4cwpdgRJdBwRgLjtx/sUwL01IBFA4qPtm6hLBgyIKILrFzJM9 xiOtbLJf0y4FyFS5wuHNxaB4q8sFK2F7P67/5/RQWCsQ9oGFBnDTdc4D+B26iZzap9Qa gTUwq1Rz9t3IIvqDWNeazaS9zPcEWsGD6g1ZM= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=MerzeYQd7mMrWj7xug82ip0Zzuk57QC86rO5mCSsEzs=; b=fKO9FwzXy4vbytD3UM6jF2djNTuZTOXPbEoIK0L3H3+O9kvoLROyvSB3DABGddwFiZ 3TNSK1GrcixiHOubVq/sBeWe5r/9otVl+4iU7Zj6etxx3qs6L48VU21Gk0aEp4BC5g8T mkNxqKC5OzqgC2Jqu9+UaFmBzwXS0pB90anDLnprG8QJf7VnoH1DgtpNkDpjI1jobW0z k62DtKPH99Y7SBvAhVMuBzQrkhlJeyvBKCzOFr51Tyw50AbHMEqnKYkKTM8Oeqs/Aq/k Plt2w0p//qI3j3m4Q0sUpGjqTRI1yS6320+jD4kfr7egXBOd8/rgM5vdfjh9bUp/OOGq ErbA== X-Gm-Message-State: APjAAAVmrNbvjqPxlRLyZXZQwQV+GFRdjE3a04hn6Hixdw4Rd4dkP5c0 Rkn4ELMrxjC5WK22jQuaZwjZ4w== X-Received: by 2002:a2e:9784:: with SMTP id y4mr10091304lji.77.1573803854082; Thu, 14 Nov 2019 23:44:14 -0800 (PST) Received: from [172.16.11.28] ([81.216.59.226]) by smtp.gmail.com with ESMTPSA id p19sm3689755lji.65.2019.11.14.23.44.13 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 14 Nov 2019 23:44:13 -0800 (PST) Subject: Re: [PATCH v4 45/47] net/wan/fsl_ucc_hdlc: reject muram offsets above 64K To: Timur Tabi Cc: Qiang Zhao , Li Yang , Christophe Leroy , linuxppc-dev@lists.ozlabs.org, linux-arm-kernel , lkml , Scott Wood , netdev References: <20191108130123.6839-1-linux@rasmusvillemoes.dk> <20191108130123.6839-46-linux@rasmusvillemoes.dk> From: Rasmus Villemoes Message-ID: <79101f00-e3ff-9dd0-7a05-760f8be1ff69@rasmusvillemoes.dk> Date: Fri, 15 Nov 2019 08:44:12 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.9.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 15/11/2019 05.41, Timur Tabi wrote: > On Fri, Nov 8, 2019 at 7:04 AM Rasmus Villemoes > 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