lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <8eb9a827-45f1-e71c-0cbf-1c29acd8e310@web.de>
Date:   Fri, 10 Jul 2020 08:32:33 +0200
From:   Markus Elfring <Markus.Elfring@....de>
To:     Paolo Bonzini <pbonzini@...hat.com>,
        Xianting Tian <xianting_tian@....com>,
        linux-scsi@...r.kernel.org,
        virtualization@...ts.linux-foundation.org
Cc:     kernel-janitors@...r.kernel.org, linux-kernel@...r.kernel.org,
        "James E. J. Bottomley" <jejb@...ux.ibm.com>,
        Jason Wang <jasowang@...hat.com>,
        "Martin K. Petersen" <martin.petersen@...cle.com>,
        "Michael S. Tsirkin" <mst@...hat.com>,
        Stefan Hajnoczi <stefanha@...hat.com>
Subject: Re: [PATCH] scsi: virtio_scsi: Remove unnecessary condition checks

>>> +	mempool_destroy(virtscsi_cmd_pool);
>>> +	virtscsi_cmd_pool = NULL;
>>> +	kmem_cache_destroy(virtscsi_cmd_cache);
>>> +	virtscsi_cmd_cache = NULL;
>>>  	return ret;
>>>  }
>>
>> How do you think about to add a jump target so that the execution
>> of a few statements can be avoided according to a previous
>> null pointer check?
>
> The point of the patch is precisely to simplify the code,

I suggest to reconsider also Linux coding style aspects
for the implementation of the function “init”.
https://elixir.bootlin.com/linux/v5.8-rc4/source/drivers/scsi/virtio_scsi.c#L980
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/scsi/virtio_scsi.c?id=42f82040ee66db13525dc6f14b8559890b2f4c1c#n980

 	if (!virtscsi_cmd_cache) {
 		pr_err("kmem_cache_create() for virtscsi_cmd_cache failed\n");
-		goto error;
+		return -ENOMEM;
	}


See also:
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/process/coding-style.rst?id=42f82040ee66db13525dc6f14b8559890b2f4c1c#n461


> executing a couple more instruction is not an issue.

With which update steps would like to achieve such a code variant?

destroy_pool:
	mempool_destroy(virtscsi_cmd_pool);
	virtscsi_cmd_pool = NULL;
destroy_cache:
	kmem_cache_destroy(virtscsi_cmd_cache);
	virtscsi_cmd_cache = NULL;
	return ret;


Regards,
Markus

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ