[alsa-devel] Help requested: new HSS1394 MIDI back-end

Clemens Ladisch clemens at ladisch.de
Mon Nov 12 12:33:47 CET 2012


Takashi Iwai wrote:
> Clemens Ladisch wrote:
>>
>> +static int scs_init_hss_address(struct scs *scs)
>> +{
>> +	u8 data[8];
>> +	int err;
>> +
>> +	*(__be64 *)data = cpu_to_be64(scs->hss_handler.offset);
>
> Wouldn't it be safer to use unaligned access or a union?

Oops, indeed.  But safest would be to avoid playing byte-array games:

  __be64 data = cpu_to_be64(((u64)HSS1394_TAG_CHANGE_ADDRESS << 56) |
                            scs->hss_handler.offset);

Now fixed in the same branch.


Regards,
Clemens


More information about the Alsa-devel mailing list