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: <20190424060212.GA5506@infradead.org>
Date:   Tue, 23 Apr 2019 23:02:12 -0700
From:   Christoph Hellwig <hch@...radead.org>
To:     Ondrej Zary <linux@...y.sk>
Cc:     Rik Faith <faith@...unc.edu>,
        "David A . Hinds" <dahinds@...rs.sourceforge.net>,
        linux-scsi@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [RFC PATCH 1/4] fdomain: Resurrect driver (core)

> +/* FIFO_COUNT: The host adapter has an 8K cache (host adapters based on the
> + * 18C30 chip have a 2k cache).  When this many 512 byte blocks are filled by
> + * the SCSI device, an interrupt will be raised.  Therefore, this could be as
> + * low as 0, or as high as 16.  Note, however, that values which are too high
> + * or too low seem to prevent any interrupts from occurring, and thereby lock
> + * up the machine.
> + */

Normally we use

/*
 * ...
 */

style comments.  I'm not sure it is worth bothering to change it in this
driver, though.

> +		cmd->SCp.ptr += len;
> +		cmd->SCp.this_residual -= len;
> +		if (!cmd->SCp.this_residual && cmd->SCp.buffers_residual) {
> +			--cmd->SCp.buffers_residual;
> +			++cmd->SCp.buffer;
> +			cmd->SCp.ptr = sg_virt(cmd->SCp.buffer);

This isn't safe on highmem systems.  At very least we need a depends on
!HIGHMEM for the drivers selecting this core driver.  If you feel like
doing the work it should use scsi_kmap_atomic_sg and
scsi_kunmap_atomic_sg.

> +static void fdomain_work(struct work_struct *work)
> +{
> +	struct fdomain *fd = container_of(work, struct fdomain, work);
> +	struct Scsi_Host *sh = container_of((void *)fd, struct Scsi_Host,
> +					    hostdata);

This looks odd.  We should never need a void cast for container_of.

> +	/* Abort calls fdomain_finish_cmd, so we do nothing here. */
> +	if (cmd->SCp.phase & aborted)
> +		;

This is a no-op..

> +	if (fd->chip == tmc1800 && !cmd->SCp.have_data_in
> +	    && (cmd->SCp.sent_command >= cmd->cmd_len)) {

&& goes on the first line, no need for the inner braces on the second
line.

> +int fdomain_host_reset(struct scsi_cmnd *cmd)

Should be static.

> +struct scsi_host_template fdomain_template = {

Should be marked const.

> +	if (fdomain_test_loopback(base))
> +		return NULL;
> +
> +	if (!irq) {
> +		if (dev_is_pci(dev)) {
> +			dev_err(dev, "PCI card has no IRQ assigned");
> +			return NULL;
> +		}
> +		irq = irqs[(inb(base + Configuration1) & 0x0e) >> 1];

The irqs lookup should probably go into the callers that need it.

> +	else if (sig && (sig->bios_major > 0) &&

No need for the inner braces.

> +EXPORT_SYMBOL(fdomain_create);

EXPORT_SYMBOL_GPL for internals like this and fdomain_destroy.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ