Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp402669imu; Tue, 11 Dec 2018 00:41:54 -0800 (PST) X-Google-Smtp-Source: AFSGD/VIE1TYotb8CfNEUYsrZ6MFbeeJAS/dJNeoh/Lzd8aQ+9i1ASLStNezXrXpuieBpJjbMmQg X-Received: by 2002:a17:902:59d6:: with SMTP id d22mr15546993plj.10.1544517714795; Tue, 11 Dec 2018 00:41:54 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1544517714; cv=none; d=google.com; s=arc-20160816; b=JE9r5KpNnQz6lK/P7RNYNrITFUKLvFeS2IDQZ2dzU1QQ2gp7CWTALdP5852b5WmJn+ r6ZoGlGS28FfIqZHlRRKh38rvUqTO6NtKMZelicOfjCKH5uBVAayjU76SSz6aYbIV9lW u0XuKcX19RmL4lcxL4b5WNqwqgG+X+pVLyFphrTbUYd5Dx9noWe4rA85GWn+kAEVMps8 wnuqFAOXYhKPcMO74P1JcbY9JQ6H7rtP59mUXpm1cEeh/clU4QXAXFaECRi763jCX+iU yyXuk5MjbRM21lo5UmntbgU6l1dJG6bj3zG0XYH9UPLfBVcvYR6ZrZES1YKeeZrEyjvn ZfIA== 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; bh=2c1q40ys1B012ldI7l8LtEQQaxXVJe8lLQYcbgzKG3s=; b=bkVq8UKnTxTcVkHY/IqrxTwgEH5iTSSVCtxid5RHbJKiAxijseQz2Nt1cQ7siXXnN5 h+ZyBP1v+8NON+ASneED/vmY4463xH7sxdDFjehQQTy8IQVCZfvOZAEcyW+vPpYhj60E SqKagj9Iz4ctY19RxD9xBiKGGsbnZOTl7hww7mp6Sy2rmnSYSAsAFz5429khwFjL9Hec BdUfYL4M/NNcd2325+/kLashftKdve8hCQ2rFULrwI9sN8pivqFMgr07lXehdhzvaV8F e1dl18btcyp9KDgLyJyV4vzlstJrYV41kr8IVTe1wxr4oOMk4ccs169dFpNi6BH/ZJs0 GsrQ== ARC-Authentication-Results: i=1; mx.google.com; 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 j20si10652297pgb.520.2018.12.11.00.41.39; Tue, 11 Dec 2018 00:41:54 -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; 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 S1726244AbeLKIjI (ORCPT + 99 others); Tue, 11 Dec 2018 03:39:08 -0500 Received: from proxima.lasnet.de ([78.47.171.185]:55545 "EHLO proxima.lasnet.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726094AbeLKIjI (ORCPT ); Tue, 11 Dec 2018 03:39:08 -0500 Received: from localhost.localdomain (unknown [88.128.80.186]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) (Authenticated sender: stefan@datenfreihafen.org) by proxima.lasnet.de (Postfix) with ESMTPSA id 5A64CC8C29; Tue, 11 Dec 2018 09:39:05 +0100 (CET) Subject: Re: [PATCH net-next] ieee802154: ca8210: fix possible u8 overflow in ca8210_rx_done To: YueHaibing , davem@davemloft.net, h.morris@cascoda.com, alex.aring@gmail.com Cc: linux-kernel@vger.kernel.org, netdev@vger.kernel.org, linux-wpan@vger.kernel.org References: <20181211031339.21048-1-yuehaibing@huawei.com> From: Stefan Schmidt Message-ID: <843d7614-7a79-2108-076e-a56bb33cb283@datenfreihafen.org> Date: Tue, 11 Dec 2018 09:39:04 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.3.0 MIME-Version: 1.0 In-Reply-To: <20181211031339.21048-1-yuehaibing@huawei.com> 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 Hello. On 11.12.18 04:13, YueHaibing wrote: > gcc warning this: > > drivers/net/ieee802154/ca8210.c:730:10: warning: > comparison is always false due to limited range of data type [-Wtype-limits] > > 'len' is u8 type, we get it from buf[1] adding 2, which can overflow. > This patch change the type of 'len' to unsigned int to avoid this,also fix > the gcc warning. > > Fixes: ded845a781a5 ("ieee802154: Add CA8210 IEEE 802.15.4 device driver") > Signed-off-by: YueHaibing > --- > drivers/net/ieee802154/ca8210.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/drivers/net/ieee802154/ca8210.c b/drivers/net/ieee802154/ca8210.c > index 0ff5a40..b2ff903 100644 > --- a/drivers/net/ieee802154/ca8210.c > +++ b/drivers/net/ieee802154/ca8210.c > @@ -721,7 +721,7 @@ static void ca8210_mlme_reset_worker(struct work_struct *work) > static void ca8210_rx_done(struct cas_control *cas_ctl) > { > u8 *buf; > - u8 len; > + unsigned int len; > struct work_priv_container *mlme_reset_wpc; > struct ca8210_priv *priv = cas_ctl->priv; > > @@ -730,7 +730,7 @@ static void ca8210_rx_done(struct cas_control *cas_ctl) > if (len > CA8210_SPI_BUF_SIZE) { > dev_crit( > &priv->spi->dev, > - "Received packet len (%d) erroneously long\n", > + "Received packet len (%u) erroneously long\n", > len > ); > goto finish; > This patch has been applied to the wpan tree and will be part of the next pull request to net. Thanks! regards Stefan Schmidt