Received: by 2002:a05:7412:b101:b0:e2:908c:2ebd with SMTP id az1csp2471365rdb; Wed, 15 Nov 2023 01:26:31 -0800 (PST) X-Google-Smtp-Source: AGHT+IFXEOu30O1q13urQ+DLguu33VewReH90ho94KdWTv3b7HcuxNg80LHCA7p0bIev+xBrNdbd X-Received: by 2002:a05:6830:440e:b0:6bd:603:797f with SMTP id q14-20020a056830440e00b006bd0603797fmr5450182otv.37.1700040391295; Wed, 15 Nov 2023 01:26:31 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1700040391; cv=none; d=google.com; s=arc-20160816; b=IO5xbPROgZBjORNAUz68bC3eD5ctrnbo7pRVPY7aKGZTtwHUQRF1HP/vhra4rkOo1u y+bRCaPd2E9fspXBecsgDJ7Dy5UMoxbrnfpcCLmz+wARdcIBJyVqiJJy7zsYR7/LywQk urTEpZFRb7zK7qjg74LDEMNCaFrBnj1gZHx0dguIrGcdluu8674KzzRs1UTK0AMRBvOE IALKJf4ueF8iZIQZq58zeWMF4L6Z1fSbaPA9RUYzGD6ONhqt2oZ5tuiJo01/HFUPBkDR gtZWMSaC0FksNDh4lEzWZIPFiqIwSQUcEuPVkwAzRrR0sC5ON988na0VEq4Rvp6DFFz1 KE5A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :mime-version:accept-language:in-reply-to:references:message-id:date :thread-index:thread-topic:subject:cc:to:from; bh=qysvhJ4q/A8SN0zkbWmbFHr3HwGaKmHtng7eJnHyx9g=; fh=w+WJlJUD29G3j6z5N+/6eNxVm129aPz8rl134iconfw=; b=nJcerPCB98eggfHB/G+TkXCd3wHQ7V9lds4WCqSSio7/D+CDQ0BdqZgRjT9ZVYRdy6 41kjs8CGoETTlCViLavwHg/eKMKAhKqNJzTFUIBmC0TwG8uM8/vOuZwzDCuEXGHRb6NZ Jxx/2vGdckrSTio8ziQTlAWfCqx9gOhKNNXO/uPMBfQNH50kOuuVe4pbvoK5Nn6m+6eF kPKI/tcflXyMLjwOrSVmBRpWqvqGlySGrI3NNBhPLmQYQbTRc+z00u1xNuhUxImrNPhb WB6TqEJs0in4/f22uywPTWwtwsJ8eYsTtwGEDQ1zJbNf6I+V7BsaIba/uxj6xvFXV5rn b+7w== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=aculab.com Return-Path: Received: from groat.vger.email (groat.vger.email. [23.128.96.35]) by mx.google.com with ESMTPS id a6-20020a634d06000000b00578b9fb24f6si9171670pgb.616.2023.11.15.01.26.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 15 Nov 2023 01:26:31 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) client-ip=23.128.96.35; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=aculab.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by groat.vger.email (Postfix) with ESMTP id 72E8980BE2CE; Wed, 15 Nov 2023 01:26:28 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at groat.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234746AbjKOJ0T convert rfc822-to-8bit (ORCPT + 99 others); Wed, 15 Nov 2023 04:26:19 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48232 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234679AbjKOJ0S (ORCPT ); Wed, 15 Nov 2023 04:26:18 -0500 Received: from eu-smtp-delivery-151.mimecast.com (eu-smtp-delivery-151.mimecast.com [185.58.86.151]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E550FFE for ; Wed, 15 Nov 2023 01:26:13 -0800 (PST) Received: from AcuMS.aculab.com (156.67.243.121 [156.67.243.121]) by relay.mimecast.com with ESMTP with both STARTTLS and AUTH (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id uk-mta-159-wXE6x5jdOEGZiCEH3TuXeA-1; Wed, 15 Nov 2023 09:26:11 +0000 X-MC-Unique: wXE6x5jdOEGZiCEH3TuXeA-1 Received: from AcuMS.Aculab.com (10.202.163.4) by AcuMS.aculab.com (10.202.163.4) with Microsoft SMTP Server (TLS) id 15.0.1497.48; Wed, 15 Nov 2023 09:26:10 +0000 Received: from AcuMS.Aculab.com ([::1]) by AcuMS.aculab.com ([::1]) with mapi id 15.00.1497.048; Wed, 15 Nov 2023 09:26:10 +0000 From: David Laight To: "'imre.deak@intel.com'" , Linus Torvalds CC: "linux-kernel@vger.kernel.org" Subject: RE: Build fail in drivers/gpu/drm/i915/display/intel_tc.c Thread-Topic: Build fail in drivers/gpu/drm/i915/display/intel_tc.c Thread-Index: AdoTX9s2sPRYSwRmSkOwOZ8JicXQjgAEEIUiABCaxIAA3tRGgAAdyf/A Date: Wed, 15 Nov 2023 09:26:10 +0000 Message-ID: References: <4df68c74c4da46ac943ac21578e9b084@AcuMS.aculab.com> <39709b4bb3e447159759a9923bd4a564@AcuMS.aculab.com> In-Reply-To: Accept-Language: en-GB, en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ms-exchange-transport-fromentityheader: Hosted x-originating-ip: [10.202.205.107] MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: aculab.com Content-Language: en-US Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8BIT X-Spam-Status: No, score=-0.8 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on groat.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (groat.vger.email [0.0.0.0]); Wed, 15 Nov 2023 01:26:28 -0800 (PST) From: Imre Deak > Sent: 14 November 2023 19:08 > > On Fri, Nov 10, 2023 at 09:00:21AM +0000, David Laight wrote: > > From: Linus Torvalds > > > Sent: 10 November 2023 00:52 > > > > > > On Thu, 9 Nov 2023 at 15:34, Imre Deak wrote: > > > > > > > > The compiler warn should be fixed/suppressed by: > > > > https://lore.kernel.org/all/20231026125636.5080-1-nirmoy.das@intel.com > > > > > > Ugh, so now it's a dynamic allocation, wasting memory, and a pointer > > > to it, using as much memory as the array did in the first place. > > > > > > All because of a pointless warning that was a false positive - and was > > > always harmless anyway, since snprintf() is safe (ie it was only a > > > "might be truncated"). > > > > That entire warning for snprintf() is a false positive. > > The ones that are likely to overflow unexpectedly are the ones > > with a "%s" format for a 'char *' pointer where there is no > > implied length. > > > > The same check for printf() using the implied buffer length > > probably does make sense. > > > > I don't even think there is a way of avoiding it on a case by case > > basis - apart from passing both the buffer address and length > > to an inline asm that the compiler has to assume might change > > the values, but that tends to generate an extra 'mov' instruction > > for no good reason at all. > > > > > > > > Please don't do this. Either do that ((tc_port & 7) + 1) suggestion of > > > David's, or just do '%c' and make the expression be > > > > > > '1' + tc_port > > > > > > which should be fine since I915_MAX_PORTS is 8 or whatever. > > Ok, the patch above was merged already to drm-tip, I'd noticed .... > but I agree not to use kasprintf for this. > The above looks ok and there is already > tc_port_name() for this, would just need to export that from > intel_display.h. I'm not sure that #define does anything except obscure what is going on. Anyone reading the code is going to search for it and then sigh. But it is your code :-) > I can follow up with a patch for this, or if you or David wanted to do > that please send a patch to the intel-gfx@lists.freedesktop.org list. Probably much easier for you to do it. My process to get patches emailed is a PITA. David - Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK Registration No: 1397386 (Wales)