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] [day] [month] [year] [list]
Date:	Thu, 20 Aug 2009 18:27:59 +0100
From:	Ben Hutchings <bhutchings@...arflare.com>
To:	Ajit Khaparde <ajitk@...verengines.com>
Cc:	davem@...emloft.net, jgarzik@...ox.com, netdev@...r.kernel.org
Subject: Re: [RFC][PATCH][v4] ethtool: Add a new ethtool option to flash a
	firmware image from the specified file to a device.

On Thu, 2009-08-20 at 22:46 +0530, Ajit Khaparde wrote:
> This patch adds a new "-f" option to the ethtool utility
> to flash a firmware image specified by a file, to a network device.
> The filename is passed to the network driver which will flash the image
> on the chip using the request_firmware path.
[...]
> @@ -304,6 +309,9 @@ static int rx_fhash_get = 0;
>  static int rx_fhash_set = 0;
>  static u32 rx_fhash_val = 0;
>  static int rx_fhash_changed = 0;
> +static char flash_file[ETHTOOL_FLASH_MAX_FILENAME];

It would be much simpler to make this a pointer...

> +static int flash = -1;
> +static int flash_region = 0;
>  static enum {
>  	ONLINE=0,
>  	OFFLINE,
[...]
> @@ -516,6 +525,10 @@ static void parse_cmdline(int argc, char **argp)
>  				if (phys_id_time < 0)
>  					show_usage(1);
>  				break;
> +			} else if (mode == MODE_FLASHDEV) {
> +				sprintf(flash_file, "%s", argp[i]);

...and to change this to "flash_file = argp[i];"...

> +				flash = 1;
> +				break;
>  			}
>  			/* fallthrough */
>  		default:
[...]
> @@ -2398,6 +2419,38 @@ static int do_grxclass(int fd, struct ifreq *ifr)
>  	return 0;
>  }
>  
> +static int do_flash(int fd, struct ifreq *ifr)
> +{
> +	struct ethtool_flash efl;
> +	int err;
> +
> +	if (flash < 0) {
> +		fprintf(stdout, "Missing filename argument\n");
> +		show_usage(1);
> +		return 98;
> +	}
> +
> +	if (strlen(flash_file) > ETHTOOL_FLASH_MAX_FILENAME - 1) {
> +		fprintf(stdout, "Filename too long\n");
> +		return 99;
> +	}
[...]

...and then this length check would work properly.

Ben.

-- 
Ben Hutchings, Senior Software Engineer, Solarflare Communications
Not speaking for my employer; that's the marketing department's job.
They asked us to note that Solarflare product names are trademarked.

--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ