[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH v2] xen: detect uninitialized xenbus in xenbus_init


  • To: Stefano Stabellini <sstabellini@xxxxxxxxxx>
  • From: Jan Beulich <jbeulich@xxxxxxxx>
  • Date: Mon, 22 Nov 2021 08:57:32 +0100
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=suse.com; dmarc=pass action=none header.from=suse.com; dkim=pass header.d=suse.com; arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=dSrjxTO3Zk74IiA4WrlnuH/o0Q/G0RuOQGIcY/f0Tro=; b=jCgz70GQtqZuF1U3NHS6KNGkBpuCrTS8ZH+rCv5QU70tW6gDXVicrLh/pCaqxc1VkVfqIEjA/+cvctWlObpRNbdM0qg8rdBDexM78Q2bgQkzaeMFc9ji5mxDrRvj6JHdJMImSrJJoXlWfG3fvlXnx0e9MaBJX/7sZHBuVn/WhSqm2tl/Y5o+JBpZNNE8Myl5v/JFJjn+QCfNZMcjyWnKTe943B85UOP0iGtPnc6ruri3kRSM+gjyBSgCDsff1GS92OpJHcfztIRyaC4deatmfihXst+XgckBZZLrNJHfgIgZhxTlOz2onSF4hBN6U++FpBIcFUNWDfLmJmjOI3rXaw==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=CqsjxoFRlLtJu4jSpKEgyWitRybWozri5RixnDRQ62E55Tsfz0uuWy6CiaRrdB4tcw/q+Ia9UYEqP7Rpvl7x+gy1NHxZx+hoZGja0+vaq7SosChP95eK36OYJ5mQnf+3YiUVItrFe/3tAZA6jHEVyX211Fw0ooFuLWbCEJBgqfHENVKyt4yU9S6m6EHy1UkGYJp6h6DQceYNKSD+9WyuGOV2j7AdErRrDPxoU3s9jlgX6KiMRy0TeFoNt2A7xFJiYQIwz8nLTpZXXR8EMaN1PxvuwFlhYO3oIT0EaqjLVkZxuhqLf8h3WkTmyyL/QPuZWiyLuxsUls/UExCe1/qFVA==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=suse.com;
  • Cc: boris.ostrovsky@xxxxxxxxxx, xen-devel@xxxxxxxxxxxxxxxxxxxx, linux-kernel@xxxxxxxxxxxxxxx, Stefano Stabellini <stefano.stabellini@xxxxxxxxxx>, stable@xxxxxxxxxxxxxxx, jgross@xxxxxxxx
  • Delivery-date: Mon, 22 Nov 2021 07:58:02 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 19.11.2021 21:29, Stefano Stabellini wrote:
> --- a/drivers/xen/xenbus/xenbus_probe.c
> +++ b/drivers/xen/xenbus/xenbus_probe.c
> @@ -951,6 +951,20 @@ static int __init xenbus_init(void)
>               err = hvm_get_parameter(HVM_PARAM_STORE_PFN, &v);
>               if (err)
>                       goto out_error;
> +             /* Uninitialized. */
> +             if (v == 0 || v == ULLONG_MAX) {

Didn't you have a comment in v1 here regarding the check against 0? Or was that
just like now only in the description? IOW I think there ought to be a code
comment justifying the theoretically wrong check ...

Also, while I realize there are various other similar assumptions elsewhere, I
would generally recommend to avoid such: There's no guarantee that now and
forever unsigned long long and uint64_t are the same thing. And it's easy in
cases like this one:

                if (!v || !(v + 1)) {

Jan




 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.