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: <46FAB4DF.4040901@tiscali.nl>
Date:	Wed, 26 Sep 2007 21:37:03 +0200
From:	roel <12o3l@...cali.nl>
To:	Konrad Rzeszutek <konrad@...nok.org>
CC:	linux-kernel@...r.kernel.org, pjones@...hat.com,
	konradr@...hat.com, konradr@...ux.vnet.ibm.com
Subject: Re: [PATCH] Add iSCSI iBFT support.

Konrad Rzeszutek wrote:

[...]

> +static ssize_t
> +ibft_read_binary(struct kobject *kobj, struct bin_attribute *attr, char *buf,
> +		 loff_t off, size_t count)
> +{
> +
> +	struct ibft_device *ibft = container_of(kobj, struct ibft_device, kobj);
> +	ssize_t len = ibft->hdr->length;
> +
> +	if (off > len)
> +		return 0;
> +
> +	if (off + count > len)
> +		count = len - off;

maybe you want to use:

count = min(count, len - off)

> +
> +	memcpy(buf, ibft->hdr + off, count);
> +
> +	return count;
> +}

[...]

> +static struct ibft_device *ibft_idev;
> +/*
> + * ibft_init() - creates  sysfs tree entry for ibft data
> + */
> +static int __init ibft_init(void)
> +{
> +	int rc = 0;
> +
> +	printk(KERN_INFO "BIOS iBFT facility v%s %s\n", ISCSI_IBFT_VERSION,
> +	       ISCSI_IBFT_DATE);
> +
> +	if (!ibft_phys)
> +		find_ibft();
> +
> +	/* What if the ibft_subsys is underneath another struct? */
> +	rc = firmware_register(&ibft_subsys);
> +	if (rc)
> +		return rc;
> +
> +	if (ibft_phys) {
> +		printk(KERN_INFO "iBFT detected at 0x%lx.\n",
> +		       (unsigned long)ibft_phys);
> +		ibft_idev = kzalloc(sizeof(*ibft_idev), GFP_KERNEL);
> +		if (!ibft_idev)
> +			return -ENOMEM;
> +
> +		rc = ibft_device_register(ibft_idev);
> +		if (rc) {
> +			kfree(ibft_idev);
> +			return rc;
> +		}

you could do without this return statement (and the brackets) since rc is returned anyway...

> +	} else {
> +		printk(KERN_INFO "No iBFT detected.\n");
> +	}

these brackets are not required either

> +	return rc;

... here

> +}

[...]

Roel
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ