lkml.org 
[lkml]   [2009]   [Oct]   [9]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] Cleanups for: line length, printk KERN_ argument, stack frame size > 2048 (added a kmalloc/kfree), style/formatting errors, incorrect include files

Try changing one thing at a time per patch please.

There's some bugs in here:

> - struct config_t dig_in_config[32];
> - struct config_t dig_out_config[32];
> - struct config_t chan_in_config[32];
> - struct config_t chan_out_config[32];
> int i;
> + config_data = kmalloc(sizeof(struct config_data_t), GFP_KERNEL);

Shouldn't that be:
config_data = kmalloc(sizeof(struct config_data_t)*32, GFP_KERNEL);

Otherwise you overflow your buffer here:
>
> for (i = 0; i < 32; i++) {
> - dig_in_config[i].kind = 0;
> - dig_in_config[i].bits = 0;
> - dig_in_config[i].min = 0;
> - dig_in_config[i].max = 0;
> - dig_out_config[i].kind = 0;
> - dig_out_config[i].bits = 0;
> - dig_out_config[i].min = 0;
> - dig_out_config[i].max = 0;
> - chan_in_config[i].kind = 0;
> - chan_in_config[i].bits = 0;
> - chan_in_config[i].min = 0;
> - chan_in_config[i].max = 0;
> - chan_out_config[i].kind = 0;
> - chan_out_config[i].bits = 0;
> - chan_out_config[i].min = 0;
> - chan_out_config[i].max = 0;
> + config_data->dig_in_config[i].kind = 0;
> + config_data->dig_in_config[i].bits = 0;
> + config_data->dig_in_config[i].min = 0;
> + config_data->dig_in_config[i].max = 0;
> + config_data->dig_out_config[i].kind = 0;
> + config_data->dig_out_config[i].bits = 0;
> + config_data->dig_out_config[i].min = 0;
> + config_data->dig_out_config[i].max = 0;
> + config_data->chan_in_config[i].kind = 0;
> + config_data->chan_in_config[i].bits = 0;
> + config_data->chan_in_config[i].min = 0;
> + config_data->chan_in_config[i].max = 0;
> + config_data->chan_out_config[i].kind = 0;
> + config_data->chan_out_config[i].bits = 0;
> + config_data->chan_out_config[i].min = 0;
> + config_data->chan_out_config[i].max = 0;
> }

Or am I mistaken?

thanks,

greg k-h


\
 
 \ /
  Last update: 2009-10-09 23:23    [W:0.072 / U:0.772 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site