[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <48D92313.3060605@ru.mvista.com>
Date: Tue, 23 Sep 2008 21:10:43 +0400
From: Sergei Shtylyov <sshtylyov@...mvista.com>
To: Mark de Wever <koraq@...all.nl>
Cc: petkovbb@...il.com, Gadi Oxman <gadio@...vision.net.il>,
Bartlomiej Zolnierkiewicz <bzolnier@...il.com>,
linux-ide@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] IDE-TAPE NULL terminate strings.
Mark de Wever 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.
My imagination sufficed to foresee how much code a compiler would have to
produce to completely initialize the arrays of the *auto* memory class -- even
regardless of optimization. And all that mostly to no purpose.
>>This is certainly worse than your initial patch (if it was correct).
> My initial patch did work,
If ide_fixstring() wouldn't have to do any space compression, it would
work. If it would have to compress spaces, 2 garbage characters would be
copied by it and then printed.
> 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.
Me too. :-)
> Regards,
> Mark de Wever
WBR, Sergei
--
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