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]
Date:	Sun, 13 Sep 2009 10:04:11 +0200
From:	Rolf Eike Beer <eike@...mail.de>
To:	Constantin Baranov <const@...as.ru>
Cc:	linux-kernel@...r.kernel.org, linux-scsi@...r.kernel.org
Subject: Re: [PATCH] hwmon: Driver for SCSI/ATA temperature sensors

Am Sonntag 13 September 2009 01:01:04 schrieb Constantin Baranov:
> The scsitemp module attaches a device to each SCSI device
> and registers it in hwmon. Currently the only method of
> reading temperature is ATA SMART. Adding support of the
> pure SCSI methods is provided.

That sounds useful. Do you have any nagios rules or something similar around 
that make use of this?

> +static int scsitemp_ata_temp_input(struct scsitemp *st, long *temp)
> +{
> +	static const u8 cdb[16] = {
> +		ATA_16,			0x08,	0x0e,			0x00,
> +		ATA_SMART_READ_VALUES,	0x00,	0x01,			0x00,
> +		0x00,			0x00,	ATA_SMART_LBAM_PASS,	0x00,
> +		ATA_SMART_LBAH_PASS,	0x00,	ATA_CMD_SMART,		0x00,
> +	};
> +
> +	u8 values[512];
> +	unsigned len = sizeof(values);
> +	unsigned nattrs, i;
> +	int err;
> +
> +	err = scsitemp_execute(st, cdb, values, &len);
> +	if (err)
> +		goto out;

How about directly doing "return err;" here? This would make the label 
superfluous and tthe code a bit more obvious.

> +	err = -ENXIO;
> +	nattrs = min_t(unsigned, 30, len / 12);
> +	for (i = 0; i < nattrs; i++) {
> +		u8 *attr = values + i * 12;
> +
> +		if (attr[2] == 194) {
> +			*temp = attr[7] * 1000;
> +			err = 0;
> +			break;
> +		}
> +	}
> +
> +out:
> +	return err;
> +}

Download attachment "signature.asc " of type "application/pgp-signature" (198 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ