From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.3 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 31AC8C432C3 for ; Fri, 15 Nov 2019 07:44:19 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 0BD812073C for ; Fri, 15 Nov 2019 07:44:19 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=rasmusvillemoes.dk header.i=@rasmusvillemoes.dk header.b="cimPOY7g" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727314AbfKOHoS (ORCPT ); Fri, 15 Nov 2019 02:44:18 -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-Google-Smtp-Source: APXvYqw8OAiLBu508szXHtSnz3QQioa3U2uijYFbTHFzEtm/A+7bHMI6CgvxmnwrGknlwyb2z4HUYw== 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 From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.0 required=3.0 tests=DKIM_INVALID,DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,URIBL_BLOCKED,USER_AGENT_SANE_1 autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 07085C432C3 for ; Fri, 15 Nov 2019 07:47:00 +0000 (UTC) Received: from lists.ozlabs.org (lists.ozlabs.org [203.11.71.2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 73B552072A for ; Fri, 15 Nov 2019 07:46:59 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=rasmusvillemoes.dk header.i=@rasmusvillemoes.dk header.b="cimPOY7g" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 73B552072A Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=rasmusvillemoes.dk Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=linuxppc-dev-bounces+linuxppc-dev=archiver.kernel.org@lists.ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 47Dr5s14NBzF1bv for ; Fri, 15 Nov 2019 18:46:57 +1100 (AEDT) Authentication-Results: lists.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=rasmusvillemoes.dk (client-ip=2a00:1450:4864:20::244; helo=mail-lj1-x244.google.com; envelope-from=linux@rasmusvillemoes.dk; receiver=) Authentication-Results: lists.ozlabs.org; dmarc=none (p=none dis=none) header.from=rasmusvillemoes.dk Authentication-Results: lists.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=rasmusvillemoes.dk header.i=@rasmusvillemoes.dk header.b="cimPOY7g"; dkim-atps=neutral Received: from mail-lj1-x244.google.com (mail-lj1-x244.google.com [IPv6:2a00:1450:4864:20::244]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 47Dr2v3Ds0zF5yW for ; Fri, 15 Nov 2019 18:44:22 +1100 (AEDT) Received: by mail-lj1-x244.google.com with SMTP id r7so9633266ljg.2 for ; Thu, 14 Nov 2019 23:44:22 -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=VsXZkpBzVW7pb/efdjAunVlABMHEb85fIh1CA02PVjyqU+VfihwaYrWJniz9kT//OX ldF6WWmKsK+DJWo9m4yp7/vsY6Vv5PvlgQAAuBYYkrcyqv6JUxiuFkcOEkElm0/xq+1z vz8LXYm1wzeqt83YcOAgW0SJTzdNdpAi92HdCnrOGf0YZwRB7+scoGx3Dubs7zZpdagH r7dupABZYFyPsFRZdVSG8aXgPyYQIhc/e+FmFOLI9dHYKvyOEhzekPirGqmnClwbpljE VhNEqNrWkvBA85f1rsDBo/XF9m3GgS7AyTCpNjrWCy18EDUIG+hUJeUkrLTFgxfc2Y5l rPPQ== X-Gm-Message-State: APjAAAUk6cz6WROsJmI8uPWmgEteHtrCDa4EHNXkCjZTsAY4DH3wb/Ku JPYQCociNU/p3Kfb4Ikmv73xcg== X-Google-Smtp-Source: APXvYqw8OAiLBu508szXHtSnz3QQioa3U2uijYFbTHFzEtm/A+7bHMI6CgvxmnwrGknlwyb2z4HUYw== 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 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 X-BeenThere: linuxppc-dev@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: netdev , lkml , Li Yang , Scott Wood , linuxppc-dev@lists.ozlabs.org, linux-arm-kernel , Qiang Zhao Errors-To: linuxppc-dev-bounces+linuxppc-dev=archiver.kernel.org@lists.ozlabs.org Sender: "Linuxppc-dev" 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 From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.3 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 43A8CC33C99 for ; Fri, 15 Nov 2019 07:44:21 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 1A7D02073C for ; Fri, 15 Nov 2019 07:44:21 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="HmU9OJpS"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=rasmusvillemoes.dk header.i=@rasmusvillemoes.dk header.b="cimPOY7g" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 1A7D02073C Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=rasmusvillemoes.dk Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:Date: Message-ID:From:References:To:Subject:Reply-To:Content-ID:Content-Description :Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=KhQXjb9nStdahOU0PGuyj4ErNkpR/w7Gu5FwQqTvZ/E=; b=HmU9OJpSZ1O2B/ +N9XauigrFhm0m3wjYOfyQmqoqcZWkBku7W7ZsGegu8KaQgqkqWFMcr1YJc9PjF4ayhK5kThLdsjp L7F3ksdsDRA8L1FikztO3gXjPmJkH53Zsfuh/P4W0q0zDkJZ+5Z+3KzQQ8q0NqdaEyuBp4m7Vt4Xp ZA6RQb9wUYg2577Y11/lIr9jmYPim3tlIokMePMe7kRR7PgX/6QDp8VeDRLBTFjc4bWdNmFvyU2tz GK/ptvlCdCBzGHG+vlhy5lydWswY/hzdhuFyrIMg9ho+XIX8yZb2VHn2st5jrZDP8wnOFDJYQG4ve CnkYZJeODJoO10ubS80A==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1iVWHE-0000IN-Cg; Fri, 15 Nov 2019 07:44:20 +0000 Received: from mail-lj1-x243.google.com ([2a00:1450:4864:20::243]) by bombadil.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1iVWHB-0000HQ-85 for linux-arm-kernel@lists.infradead.org; Fri, 15 Nov 2019 07:44:18 +0000 Received: by mail-lj1-x243.google.com with SMTP id t5so9635414ljk.0 for ; Thu, 14 Nov 2019 23:44:15 -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=Sy5hWcmzeoeusf2xv14jX1rNfu+0GAK8G6cdXHCUvDbnKLgvQAzigV6OBXTaYkHHpx H1NsJxiPMbtiL+Hi6ERUurlRK8brHivcFsj3/y3/abkissf/liiDlLlxzTc8eZ2hTmSp XKA588wDjxRPysucKojpHSr2RpGmnIhhq4eNs5Y6Xjl08ecOXAta0W4FJ5cFAxX+2Ht6 dbT36bnD45Nzbxs4iNFG2eZ/ZsV7vsmB28qsxQz2WaxVsMQB0OIEfN6ixVXJkG1NDCXq dlUIYbrf2TccdfLdmAm/N6Zlgc3Njw0OFEgu7m4HDmGASwc29Mn8eOYkVen6vUBoVJId zTLw== X-Gm-Message-State: APjAAAWv0uv0joxRa8eQaHFOXWGGNt2KpA/6FXpnDL61gt7Pc1W11qUM 1FpeLb4u52GkSgfjmNCWrhhb2A== X-Google-Smtp-Source: APXvYqw8OAiLBu508szXHtSnz3QQioa3U2uijYFbTHFzEtm/A+7bHMI6CgvxmnwrGknlwyb2z4HUYw== 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 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-Language: en-US X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20191114_234417_438106_0E0A9A8F X-CRM114-Status: GOOD ( 15.48 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Christophe Leroy , netdev , lkml , Li Yang , Scott Wood , linuxppc-dev@lists.ozlabs.org, linux-arm-kernel , Qiang Zhao Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.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 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel