lkml.org 
[lkml]   [2008]   [Sep]   [23]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] IDE-TAPE NULL terminate strings.
On Tue, Sep 23, 2008 at 01:08:25AM +0400, Sergei Shtylyov wrote:
>> diff --git a/drivers/ide/ide-tape.c b/drivers/ide/ide-tape.c
>> index 1bce84b..c41f5b1 100644
>> --- a/drivers/ide/ide-tape.c
>> +++ b/drivers/ide/ide-tape.c
>> @@ -2338,7 +2338,7 @@ static void idetape_get_inquiry_results(ide_drive_t *drive)
>> {
>> idetape_tape_t *tape = drive->driver_data;
>> struct ide_atapi_pc pc;
>> - char fw_rev[6], vendor_id[10], product_id[18];
>> + char fw_rev[6] = {'\0'}, vendor_id[10] = {'\0'}, product_id[18] = {'\0'};
>>
>
> Do you realize how much *absolutely unnecessary* code will this bring
> in?

I did not, I just had a look at the code GCC produced. I did expect much
smaller code, but maybe that's only generated with -Os.

> This is certainly worse than your initial patch (if it was correct).

My initial patch did work, but that doesn't matter much, since Boris
posted another patch based on your suggestions. I like that patch better
as my initial patch. I'm testing it now and I expect it to work.

Regards,
Mark de Wever


\
 
 \ /
  Last update: 2008-09-23 18:19    [W:1.439 / U:0.104 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site