platform/x86: think-lmi: Avoid potential read before start of the buffer

If length equals 0 then reading buf[length-1] will read before the start
of the buffer.

Avoid this by moving the length == 0 check up.

Cc: Mark Pearson <markpearson@lenovo.com>
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Link: https://lore.kernel.org/r/20210609151752.156902-2-hdegoede@redhat.com
This commit is contained in:
Hans de Goede 2021-06-09 17:17:52 +02:00
commit 0ddcf3a6b4