From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 3576857CA8; Fri, 3 May 2024 06:51:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714719113; cv=none; b=LexDiu0kNeBOI5PmEtrsV9xloBYsHfK7Z8Z+tAO5C8yTAm7KrX1AQtlFEB7iPD3wsNMupDKc4RmWtA7Vlpl51cpSmPWykgRz8JXW4ssNKY2FVYRLH1Oos/NNOG9OxJUa13BWKFZ/c/ggh0abIt5mQO836ay/qYrs1PoJmsu6RNk= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714719113; c=relaxed/simple; bh=wT02tiM4wXh96p/92paNbLUWSCzZQvWt8NNAabXOQNQ=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=NMOYuHN4A/tkuuu9XaqTXA4Vcu437VWOEA+n+yYxhq38GyKwFCgohiI5nShqL5ffsX6Oh7bApU3dSk7NoHOggf9pL/xLJrsX51Dk0EsiOh8HNAGA22HqTOsVI8ZkX+I0KYvcgDe236WnzoEN4WBPh6omCMnKZ5wwJKJJ58ChFys= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=D2JqoKOi; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="D2JqoKOi" Received: by smtp.kernel.org (Postfix) with ESMTPSA id F0AB5C116B1; Fri, 3 May 2024 06:51:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1714719112; bh=wT02tiM4wXh96p/92paNbLUWSCzZQvWt8NNAabXOQNQ=; h=Date:From:To:List-Id:Cc:Subject:References:In-Reply-To:From; b=D2JqoKOid/E7ElVPPALhAw5Rt+fgl6zYg73kWZfbf5bELCPTjSyrahQaNKBX31fJ0 EJIxD878l9/a9F3JtE2e7gyt1k0AmRAL+9V999XLGEPfPRiWZSAc1ytp5FdIXl+eGJ 0QEmHGJw/u+2G+XpwUaqWIx2qkfW5U0dDt0nIIzBwyMw3Hr67nqTE6kAFizMrGSkii 4sLiWNyoH75e/vD180aXkKq0pcPNmzmD3ZiQvgindgDHn8DbyUVxpRksfYj7PzGyV1 pYcTQIU+m0pW/ag3hQCCkoJK4l01lBrwR36/y/VxMF8Z/6fgZM9NXjy4wFVhf+n3ws hxExaDEtLUoag== Date: Fri, 3 May 2024 08:51:32 +0200 From: Marek =?utf-8?B?QmVow7pu?= To: Andy Shevchenko Cc: Gregory CLEMENT , Arnd Bergmann , soc@kernel.org, arm@kernel.org, Hans de Goede , Ilpo =?utf-8?B?SsOkcnZpbmVu?= , Linus Walleij , Bartosz Golaszewski , linux-gpio@vger.kernel.org, Alessandro Zummo , Alexandre Belloni , linux-rtc@vger.kernel.org, Wim Van Sebroeck , Guenter Roeck , linux-watchdog@vger.kernel.org Subject: Re: [PATCH v8 2/9] platform: cznic: Add preliminary support for Turris Omnia MCU Message-ID: <20240503065132.f3tellvhidjly4pf@kandell> References: <20240430115111.3453-1-kabel@kernel.org> <20240430115111.3453-3-kabel@kernel.org> <20240430160507.45f1f098@dellmb> <20240502184005.fsdbwrbzmv5gshxh@kandell> <20240502191756.ynwmp74yybat57my@kandell> Precedence: bulk X-Mailing-List: linux-watchdog@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: On Fri, May 03, 2024 at 06:59:20AM +0300, Andy Shevchenko wrote: > On Thu, May 2, 2024 at 10:18 PM Marek Behún wrote: > > On Thu, May 02, 2024 at 09:47:25PM +0300, Andy Shevchenko wrote: > > > On Thu, May 2, 2024 at 9:40 PM Marek Behún wrote: > > > > On Tue, Apr 30, 2024 at 06:17:45PM +0300, Andy Shevchenko wrote: > > > > > On Tue, Apr 30, 2024 at 04:05:07PM +0200, Marek Behún wrote: > > > > > > On Tue, 30 Apr 2024 15:53:51 +0300 > > > > > > Andy Shevchenko wrote: > > > > > > > On Tue, Apr 30, 2024 at 2:51 PM Marek Behún wrote: > > ... > > > > > > > > > +static int omnia_get_version_hash(struct omnia_mcu *mcu, bool bootloader, > > > > > > > > + u8 version[static OMNIA_FW_VERSION_HEX_LEN]) > > > > > > > > > > > > > > Interesting format of the last parameter. Does it make any difference > > > > > > > to the compiler if you use u8 *version? > > > > > > > > > > > > The compiler will warn if an array with not enough space is passed as > > > > > > argument. > > > > > > > > > > Really? > > > > > > > > Indeed: > > > > > > > > extern void a(char *x); > > > > > > > > static void b(char x[static 10]) { > > > > a(x); > > > > } > > > > > > > > void c(void) { > > > > char x[5] = "abcd"; > > > > > > > b(x); > > > > > > It's not the example I was talking about. Here should be a(x). > > > > Somehow I got lost. Let's return to my function, where I have > > int omnia_get_version_hash(..., u8 version[static 40]); > > > > and then I use this function: > > > > u8 version[40]; > > omnia_get_version_hash(..., version); > > > > If somehow I made a mistake and declared the version array shorter: > > u8 version[20]; > > omnia_get_version_hash(..., version); > > I would get a warning. > > Yes. Would you get the same warning if you replace the parameter to a pointer? If you mean instead of declaring u8 version[20]; if I did u8 *version; omnia_get_version_hash(..., version); then I will get a different warning: version is used uninitialized And if you mean that instead of the char version[static 40] in the argument list of the function I used char *version, then no, GCC spits no warning. Marek