Subject: Re: sys/dev/scsipi/scsipi_base.c
To: Alan Barrett <apb@cequrux.com>
From: Perry E. Metzger <perry@piermont.com>
List: current-users
Date: 01/06/2008 12:19:21
Alan Barrett <apb@cequrux.com> writes:
> On Sun, 06 Jan 2008, David Laight wrote:
>> > memcpy(inqbuf->vendor, "ADAPTEC ACB-4000            ", 28);
>> > yet inqbuf->vendor is declared in struct scsipi_inquiry_data as:
>> > char    vendor[8];
>> and is followed by:
>>   char    product[16];
>>   char    revision[4];
>> so the memcpy updates all 3 fields :-)
>
> This is rather ugly, but it's either guaranteed to work, or will work
> with all except the most perverse C language implementations.

True, but is there a good reason to commit a type violation just to
save an inconsequential amount of time and space by avoiding two more
calls?

Perry