Re: [PATCH] cxd2820r: fix possible out-of-array lookup

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



2011/7/23 Malcolm Priestley <tvboxspy@xxxxxxxxx>:
> On Sat, 2011-07-23 at 01:47 +0200, HoP wrote:
>> 2011/7/23 Antti Palosaari <crope@xxxxxx>:
>> > On 07/23/2011 02:31 AM, Antti Palosaari wrote:
>> >>
>> >> On 07/23/2011 02:01 AM, HoP wrote:
>> >>>
>> >>> 2011/7/23 Antti Palosaari<crope@xxxxxx>:
>> >>>>
>> >>>> But now I see what you mean. msg2[1] is set as garbage fields in case of
>> >>>> incoming msg len is 1. True, but it does not harm since it is not
>> >>>> used in
>> >>>> that case.
>> >>>
>> >>> In case of write, cxd2820r_tuner_i2c_xfer() gets msg[] parameter
>> >>> with only one element, true? If so, then my patch is correct.
>> >>
>> >> Yes it is true but nonsense. It is also wrong to make always msg2 as two
>> >> element array too, but those are just simpler and generates most likely
>> >> some code less. Could you see it can cause problem in some case?
>> >
>> > Now I thought it more, could it crash if it point out of memory area?
> Arrays are not fussy they will read anything, just don't poke them :-)

Are you sure about not crashing? On every architecture on which linux
can run?

Even if it not crash kernel, I hope we can agree that it is incorrect
and need to be fixed.

>>
>> I see you finally understood what I wanted to do :-)
>>
>> I'm surprised that it not crashed already. I thought I have to missed something.
>
> It does not crash because num is constant throughout, when the number of
> messages is one the second element isn't transferred.

Sure, that is evident. My fix was about not do read access outside
of input array msg[]. I still don't understand the NACK.

/Honza
--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Input]     [Video for Linux]     [Gstreamer Embedded]     [Mplayer Users]     [Linux USB Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux