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:   Sat, 29 Jun 2019 16:58:46 -0700
From:   Joe Perches <joe@...ches.com>
To:     Gabriel Beauchamp <beauchampgabriel@...il.com>,
        gregkh@...uxfoundation.org, christian.gromm@...rochip.com,
        colin.king@...onical.com, gustavo@...eddedor.com
Cc:     devel@...verdev.osuosl.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] Staging: most: fix coding style issues

On Sat, 2019-06-29 at 16:44 -0700, Gabriel Beauchamp wrote:
> This is a patch for the core.[ch] files that fixes up warnings
> found with the checkpatch.pl tool.
[]
> diff --git a/drivers/staging/most/core.c b/drivers/staging/most/core.c
[]
> @@ -303,7 +303,8 @@ static ssize_t set_datatype_show(struct device *dev,
>  
>  	for (i = 0; i < ARRAY_SIZE(ch_data_type); i++) {
>  		if (c->cfg.data_type & ch_data_type[i].most_ch_data_type)
> -			return snprintf(buf, PAGE_SIZE, "%s", ch_data_type[i].name);
> +			return snprintf(buf, PAGE_SIZE,
> +					"%s", ch_data_type[i].name);
>  	}
>  	return snprintf(buf, PAGE_SIZE, "unconfigured\n");
>  }

Assuming the newline difference is unintentional,
(if not change "unconfigured" to "unconfigured\n")

How about using a single sprintf and reducing object code size too?

	char *type = "unconfigured";

	for (...)
		if (c-> etc...) {
			type = ch_data_type[i].name;
			break;
		}
	}

	return snprintf(buf, PAGE_SIZE, "%s", type);



Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ