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: <20140429103527.GB26890@mwanda>
Date:	Tue, 29 Apr 2014 13:35:27 +0300
From:	Dan Carpenter <dan.carpenter@...cle.com>
To:	Oleg Drokin <green@...uxhacker.ru>
Cc:	Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
	linux-kernel@...r.kernel.org, devel@...verdev.osuosl.org,
	James Simmons <uja.ornl@...il.com>, Li Xi <lixi@....com>
Subject: Re: [PATCH 34/47] staging/lustre/libcfs: add CPU table functions for
 uniprocessor

On Sun, Apr 27, 2014 at 01:06:58PM -0400, Oleg Drokin wrote:
>  int
> +cfs_cpt_table_print(struct cfs_cpt_table *cptab, char *buf, int len)
> +{
> +	int	rc = 0;

GCC has a feature where it warns about unitialized variables.  If you do
bogus it disables this safety feature.  Also the bogus assignment is
confusing for people trying to read the code.

> +
> +	rc = snprintf(buf, len, "%d\t: %d\n", 0, 0);
> +	len -= rc;
> +	if (len <= 0)
> +		return -EFBIG;

It would be more clear to say:

	rc = snprintf(buf, len, "%d\t: %d\n", 0, 0);
	if (rc >= len)
		return -EFBIG;

	return rc;

regards,
dan carpenter

> +
> +	return rc;
> +}
> +EXPORT_SYMBOL(cfs_cpt_table_print);
> +

--
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