From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934084AbcJYUFU (ORCPT ); Tue, 25 Oct 2016 16:05:20 -0400 Received: from youngberry.canonical.com ([91.189.89.112]:43471 "EHLO youngberry.canonical.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753282AbcJYUFQ (ORCPT ); Tue, 25 Oct 2016 16:05:16 -0400 Subject: Re: [PATCH] iio: maxim_thermocouple: return -EINVAL on invalid read size To: Lars-Peter Clausen , 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: Colin Ian King Message-ID: <08aed45b-08a0-27be-d8ee-c051ef05bfe6@canonical.com> Date: Tue, 25 Oct 2016 21:05:12 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.3.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 25/10/16 20:11, Lars-Peter Clausen wrote: > 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 > Not my day :-) Colin