From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 03A4D34BA4D; Fri, 26 Sep 2025 14:16:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1758896215; cv=none; b=PRnZfcgcDe3sDn7ppP6tqb5W+EPb/nE161IgZPLMciG39K08UvORHkZwWhjbPgZ4gN3GQ0XIZKstVZCSczljR9Ftw+VLtXmWpd8Q6J9gyS3+SpPY135I6J/Cw96507Q4aBEIgKu7hBoP3gPJqbQGuenrZQSk2mdHGV8/W+Ej3E4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1758896215; c=relaxed/simple; bh=F4CqQMNBgfWe4UbwdKx5Y63fVKA5uKqONA1gN72GIX8=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=A+pLt9LiFJRYCbfBshVEdcx7zgawp5Hp7uC6sLf3dDs7+feMGPlc4Q1SqmV40B2eyzYj4FV7tg6HiO+dXH49HJ2hxOZeObFN2E7fuCgk1QzDnEhJKTej7L8E7vJ39HAI1A74KZExnWJeDPYxG/wT601ISmDW8eXllY3IAKO8cyo= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=oC+5PZ06; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="oC+5PZ06" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 262F3C4CEF4; Fri, 26 Sep 2025 14:16:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1758896214; bh=F4CqQMNBgfWe4UbwdKx5Y63fVKA5uKqONA1gN72GIX8=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=oC+5PZ06H3soR/JIkFyonjknXzN/9X0ZfeAKMVrj01hHfCeUpV2HMmnF14nZ3WUC2 MlGqGXl0g/JBM154y7q2oKzQquSdi7J2fjR6dzZW5l1fJFw5o7CGiIQinUx3PkgwyK +4GaKpFdSnIqqwaVoxHQQzakOXCd8gAjgLqaPbh6Dz1H2AGUbn+vHOGwlSsfxuZ8/I ekNKq/yjcwKr4i1idojRPjv/2CzAi7sCML1ospUoYF5q5vWM12Uz+NMAwSQ2o9relz iczc0hWKQgdlNtj4ArK/woRxO7amuYXpua2SY2SdyZ668pSiqYllDsFWalx2LI42jT E55X73GFM8iYw== Date: Fri, 26 Sep 2025 15:16:50 +0100 From: Simon Horman To: Adam Young Cc: Jeremy Kerr , Matt Johnston , Andrew Lunn , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Sudeep Holla , Jonathan Cameron , Huisong Li Subject: Re: [PATCH net-next v29 3/3] mctp pcc: Implement MCTP over PCC Transport Message-ID: References: <20250925190027.147405-1-admiyo@os.amperecomputing.com> <20250925190027.147405-4-admiyo@os.amperecomputing.com> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20250925190027.147405-4-admiyo@os.amperecomputing.com> On Thu, Sep 25, 2025 at 03:00:26PM -0400, Adam Young wrote: ... > +static int initialize_MTU(struct net_device *ndev) > +{ > + struct mctp_pcc_ndev *mctp_pcc_ndev = netdev_priv(ndev); > + struct mctp_pcc_mailbox *outbox; > + int mctp_pcc_mtu; > + > + outbox = &mctp_pcc_ndev->outbox; > + outbox->chan = pcc_mbox_request_channel(&outbox->client, outbox->index); > + mctp_pcc_mtu = outbox->chan->shmem_size - sizeof(struct pcc_header); Hi Adam, On the line below it is expected that outbox->chan may be an error value rather than a valid pointer. But on the line above outbox->chan is dereferenced. This does not seem consistent. Flagged by Smatch. > + if (IS_ERR(outbox->chan)) > + return PTR_ERR(outbox->chan); > + > + pcc_mbox_free_channel(mctp_pcc_ndev->outbox.chan); > + > + mctp_pcc_ndev = netdev_priv(ndev); > + ndev->mtu = MCTP_MIN_MTU; > + ndev->max_mtu = mctp_pcc_mtu; > + ndev->min_mtu = MCTP_MIN_MTU; > + > + return 0; > +} ... -- pw-bot: changes-requested