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:	Tue, 10 Dec 2013 10:05:40 +0900
From:	Namhyung Kim <namhyung@...nel.org>
To:	Masami Hiramatsu <masami.hiramatsu.pt@...achi.com>
Cc:	Steven Rostedt <rostedt@...dmis.org>,
	Oleg Nesterov <oleg@...hat.com>,
	Srikar Dronamraju <srikar@...ux.vnet.ibm.com>,
	Hyeoncheol Lee <cheol.lee@....com>,
	"zhangwei\(Jovi\)" <jovi.zhangwei@...wei.com>,
	Arnaldo Carvalho de Melo <acme@...stprotocols.net>,
	Hemant Kumar <hkshaw@...ux.vnet.ibm.com>,
	LKML <linux-kernel@...r.kernel.org>,
	Namhyung Kim <namhyung.kim@....com>
Subject: Re: [PATCH 08/17] tracing/probes: Split [ku]probes_fetch_type_table

Hi Masami,

On Tue, 10 Dec 2013 00:09:36 +0900, Masami Hiramatsu wrote:
> (2013/12/09 15:19), Namhyung Kim wrote:
>> @@ -398,21 +376,21 @@ static const struct fetch_type *find_fetch_type(const char *type)
>>  
>>  		switch (bs) {
>>  		case 8:
>> -			return find_fetch_type("u8");
>> +			return find_fetch_type("u8", ftbl);
>>  		case 16:
>> -			return find_fetch_type("u16");
>> +			return find_fetch_type("u16", ftbl);
>>  		case 32:
>> -			return find_fetch_type("u32");
>> +			return find_fetch_type("u32", ftbl);
>>  		case 64:
>> -			return find_fetch_type("u64");
>> +			return find_fetch_type("u64", ftbl);
>>  		default:
>>  			goto fail;
>>  		}
>>  	}
>>  
>> -	for (i = 0; i < ARRAY_SIZE(fetch_type_table); i++)
>> -		if (strcmp(type, fetch_type_table[i].name) == 0)
>> -			return &fetch_type_table[i];
>> +	for (i = 0; i < NR_FETCH_TYPES; i++)
>
> Hmm, I consider this should use correct length of given array. Thus,
> I'd like recommend you to do;
> giving the size of fetch_type_table, or define *probe_fetch_type_table with
> NR_FETCH_TYPES size, or introduce a gatekeeper, e.g. special terminator entry
> for initializing.

Ah, okay.  So I'd like to go with the gatekeeper approach since I added
the NR_FETCH_TYPES only for iterating the table so no need to keep the
size itself.  And it might be better for additional change in the
future.

Thanks,
Namhyung

>
>> +/* Fetch type information table */
>> +const struct fetch_type uprobes_fetch_type_table[] = {
>
> For example, here if I see the NR_FETCH_TYPES in above [], I can ensure
> the table has at least that size (and if there is a space, it will be
> filled with zero, in that case, we just need to add a checking
> fetch_type_table[i].name != NULL).
>
> Thank you,
--
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