From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934154AbcJYTLd (ORCPT ); Tue, 25 Oct 2016 15:11:33 -0400 Received: from www381.your-server.de ([78.46.137.84]:38875 "EHLO www381.your-server.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932711AbcJYTLa (ORCPT ); Tue, 25 Oct 2016 15:11:30 -0400 Subject: Re: [PATCH] iio: maxim_thermocouple: return -EINVAL on invalid read size To: Colin King , Jonathan Cameron , Hartmut Knaack , Peter Meerwald-Stadler , sayli karnik , Matt Ranostay , Wei Yongjun , linux-iio@vger.kernel.org References: <20161025190408.5012-1-colin.king@canonical.com> Cc: linux-kernel@vger.kernel.org From: Lars-Peter Clausen Message-ID: Date: Tue, 25 Oct 2016 21:11:21 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Icedove/45.4.0 MIME-Version: 1.0 In-Reply-To: <20161025190408.5012-1-colin.king@canonical.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-Authenticated-Sender: lars@metafoo.de Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 10/25/2016 09:04 PM, Colin King wrote: > From: Colin Ian King > > In the case that the read size is not 2 or 4 bytes > then maxim_thermocouple_read is not initializing ret and > hence may return early with a bogus error return or > just through to return with a bogos unread value in *val. > Fix this by setting ret to -EINVAL for invalid (unhandled) > read sizes. > > Signed-off-by: Colin Ian King Again, Arnd already took the prize, https://lkml.org/lkml/2016/10/25/518