Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp1067719pxb; Fri, 26 Feb 2021 01:28:01 -0800 (PST) X-Google-Smtp-Source: ABdhPJyj5UkhRpi01DyGAtNtLc8QShLa3kYYfmLXnWBl++UjqW63iMkjkdYWCWHY4FLWweOG6Oi8 X-Received: by 2002:a17:906:4f02:: with SMTP id t2mr2293291eju.121.1614331681649; Fri, 26 Feb 2021 01:28:01 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1614331681; cv=none; d=google.com; s=arc-20160816; b=UQsH+p3/MViJ6YW6F32C/vtiZ4+dbkGlmSUYapE2vp3W9bYRf+5YBXKtrghM03pzUA fekOpMfLWcwBR9SvcTnOTN7u2zpyYZ1qW5tYrRUJaKtubIG+VlU/5qtTbEWfnrPCxL1l 6y2Wt8pry+71lDvFtOcC3XL8o8kqBI4eW1iG7/O1xSuSxmHAXaTiyscVWmKiuFijgrgb Ujzd1zCB3lf5Xa9dmlSUWXgQTq/xiU08/oGgUCxEsie7U1K3SUTaOkzNtLlS8AF7tz7K EJaLRUvlDC4B1bUjixsZ5OaxChtGsIKXZRImWVjHl3MvEzaazvdEk+4etiFmuFU/hmoD bXMg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date; bh=6TxGZ7qsRnY7Y+3KSDLJcxZk4cr/z874JKdau49ZeBk=; b=ev9A71cPDV+ZCh5q7Cg6/qGukWVq0q5v7IBQlsK5p+mj0Q7HOj+LqC0WKTJbCDbjdR qH5URZdGnuqWflES128rsTBbr6+z1U4b5vrf3mGkTMtQ1zmpe5l69SIuaspNojp0irYz tI6e1HihiqVxvHY2q8/qxmrbWLzAkLVLJ74EIpkjfJ6Fjw9W+zlqSreaOEcyBCMhUJYc R5cAG6prN/etOdefcClXSCx6P/4eplUsUqIbhuDDF/KWiMsTEZsA8f1YBJLsA3/OnYqU mQ094pQAA6yDZvwlHHwJNka2NNhkf/XAnN9OhnFVHrSzXB5i3SgehKz9qzUQbLig6ZEM +++A== 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id s13si5383598edj.330.2021.02.26.01.27.39; Fri, 26 Feb 2021 01:28:01 -0800 (PST) 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230316AbhBZJYi (ORCPT + 99 others); Fri, 26 Feb 2021 04:24:38 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42154 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230360AbhBZJW6 (ORCPT ); Fri, 26 Feb 2021 04:22:58 -0500 Received: from metis.ext.pengutronix.de (metis.ext.pengutronix.de [IPv6:2001:67c:670:201:290:27ff:fe1d:cc33]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8DA08C061786 for ; Fri, 26 Feb 2021 01:22:17 -0800 (PST) Received: from gallifrey.ext.pengutronix.de ([2001:67c:670:201:5054:ff:fe8d:eefb] helo=bjornoya.blackshift.org) by metis.ext.pengutronix.de with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lFZJy-0005J6-4z; Fri, 26 Feb 2021 10:22:02 +0100 Received: from pengutronix.de (unknown [IPv6:2a03:f580:87bc:d400:adc1:3ee1:6274:c5d0]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-384) server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) (Authenticated sender: mkl-all@blackshift.org) by smtp.blackshift.org (Postfix) with ESMTPSA id DBBA05E99BB; Fri, 26 Feb 2021 09:21:59 +0000 (UTC) Date: Fri, 26 Feb 2021 10:21:58 +0100 From: Marc Kleine-Budde To: Dario Binacchi Cc: linux-kernel@vger.kernel.org, Alexander Stein , Federico Vaga , "David S. Miller" , Jakub Kicinski , Oliver Hartkopp , Vincent Mailhol , Wolfgang Grandegger , YueHaibing , Zhang Qilong , linux-can@vger.kernel.org, netdev@vger.kernel.org Subject: Re: [PATCH v2 5/6] can: c_can: prepare to up the message objects number Message-ID: <20210226092158.krmrds75hy6g3vks@pengutronix.de> References: <20210225215155.30509-1-dariobin@libero.it> <20210225215155.30509-6-dariobin@libero.it> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="hovsnqewnww35o2i" Content-Disposition: inline In-Reply-To: <20210225215155.30509-6-dariobin@libero.it> X-SA-Exim-Connect-IP: 2001:67c:670:201:5054:ff:fe8d:eefb X-SA-Exim-Mail-From: mkl@pengutronix.de X-SA-Exim-Scanned: No (on metis.ext.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: linux-kernel@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --hovsnqewnww35o2i Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On 25.02.2021 22:51:54, Dario Binacchi wrote: > --- a/drivers/net/can/c_can/c_can.c > +++ b/drivers/net/can/c_can/c_can.c [...] > -struct net_device *alloc_c_can_dev(void) > +struct net_device *alloc_c_can_dev(int msg_obj_num) > { > struct net_device *dev; > struct c_can_priv *priv; > + int msg_obj_tx_num =3D msg_obj_num / 2; > =20 > - dev =3D alloc_candev(sizeof(struct c_can_priv), C_CAN_MSG_OBJ_TX_NUM); > + dev =3D alloc_candev(sizeof(*priv) + sizeof(u32) * msg_obj_tx_num, > + msg_obj_tx_num); > if (!dev) > return NULL; > =20 > priv =3D netdev_priv(dev); > - netif_napi_add(dev, &priv->napi, c_can_poll, C_CAN_NAPI_WEIGHT); > + priv->msg_obj_num =3D msg_obj_num; > + priv->msg_obj_rx_num =3D msg_obj_num - msg_obj_tx_num; > + priv->msg_obj_rx_first =3D 1; > + priv->msg_obj_rx_last =3D > + priv->msg_obj_rx_first + priv->msg_obj_rx_num - 1; > + priv->msg_obj_rx_mask =3D ((u64)1 << priv->msg_obj_rx_num) - 1; Here you're casting the 1 to 64bit, but msg_obj_rx_mask is only u32. Use "1UL", if you are sure that rx_mask would never exceed 32 bit. Marc --=20 Pengutronix e.K. | Marc Kleine-Budde | Embedded Linux | https://www.pengutronix.de | Vertretung West/Dortmund | Phone: +49-231-2826-924 | Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 | --hovsnqewnww35o2i Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQEzBAABCgAdFiEEK3kIWJt9yTYMP3ehqclaivrt76kFAmA4vbMACgkQqclaivrt 76lH3Af/daiXgsp1o5BDGL82GyxOG6ElrbK18/+tHyFptfaofu6jQHNYpdEawnl+ T4vQrNUSmLWFGq5bCRq3Br58heLLauUCqg9FeJFEEMgZB4/3sja78lgyb00pWJra cozJH/YweiB8pqK/Vio5c2KDX1QG1fUfVaD4Q677wdtpLt8N8vqhwCYSm8+3dD3Z tQI37W6P9TqI+kughgahD9YZHkQbwX1S6uq7oXFEFhayhMfKtwxORnx8stu6dzdP sZYOnGO+FHRIlB1wpQ4Q7s6rRb5NXp4AVyIBeAWkM8oxv0lM9vWrSOhvecqOCf9U XmEswW396ahY0yMAtUe0kwrVi01mVQ== =FzS5 -----END PGP SIGNATURE----- --hovsnqewnww35o2i--