Received: by 2002:a05:7412:1e0b:b0:fc:a2b0:25d7 with SMTP id kr11csp412271rdb; Thu, 15 Feb 2024 04:17:19 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCWNEigEUW0lJC1If0nsPvtTOlDEG8twQIbDQXUn7sNddkRaj6OD4HwezTV/80Q4cQrZEMtTOaTa5n84mrvAPNRaOMOt8YlddsaUW2YbYg== X-Google-Smtp-Source: AGHT+IFFN8PgYf9z/jMUwAp89SzwBpP3q53D8qCQOjie+RYTrim8vPOcyxSJ8PJB8ZzNLa3dNQo9 X-Received: by 2002:a05:6512:3f9:b0:511:9c70:1c66 with SMTP id n25-20020a05651203f900b005119c701c66mr1254733lfq.51.1707999439009; Thu, 15 Feb 2024 04:17:19 -0800 (PST) Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id l20-20020a50d6d4000000b005639fbc2756si597740edj.286.2024.02.15.04.17.18 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 15 Feb 2024 04:17:18 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-66870-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@intel.com header.s=Intel header.b="aZ/tVpPT"; arc=fail (body hash mismatch); spf=pass (google.com: domain of linux-kernel+bounces-66870-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-66870-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id B973E1F22F86 for ; Thu, 15 Feb 2024 12:17:18 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id B92BD12BF3D; Thu, 15 Feb 2024 12:17:10 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=intel.com header.i=@intel.com header.b="aZ/tVpPT" Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.13]) (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 EB96F12BEAF; Thu, 15 Feb 2024 12:17:07 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.198.163.13 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707999430; cv=none; b=Yrum2QewLfM5Ucn2mpVPw/NLJ8NWNqvb6eaR2t8IsfxFGnqJzNQck3rmb9L0RTO61h473jqmTDwSvTJIvjJ5rGvkvmlJCN69hdMTIxtrDzRUbBOzUVl/cfHKvZ4m2eJGGSIeiojsElL7+nEtUR+a4YneHyDkLISNVsjuW+QKqcE= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707999430; c=relaxed/simple; bh=zFgVeZ+HCPKzMsMvNy4bcqrK2mPXB/8qWs0nNlUKGR8=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=DKFOBT6WEGnO0X18WW8YFeKNxWqqMPZTPKAKBWkOtsXK8+RGica+kKTX+zCfMadAKX/46CYTNt/aCS9MSPXybPLKtoiBs+rPK2X7mPU38EzgX8criZ3WoaHnVg+NaK1XXbIRa0fjxWpPhBfrsTwUMkuNdbApD52KOlDFzZvHOFs= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com; spf=none smtp.mailfrom=linux.intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=aZ/tVpPT; arc=none smtp.client-ip=192.198.163.13 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=linux.intel.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1707999428; x=1739535428; h=date:from:to:cc:subject:message-id:references: mime-version:content-transfer-encoding:in-reply-to; bh=zFgVeZ+HCPKzMsMvNy4bcqrK2mPXB/8qWs0nNlUKGR8=; b=aZ/tVpPTUPNsEHgqs7GZHe6nXe+DXqfuX6VSjuWDJx6kY1uyuVRkQDvT fouf95ppAe1CMW1lWBPdfL+ngSng5JzOeCisQqMw+bi+O15J/Cyj9oMML 43GNZonbWzgtd6bTqztxpyMVA7UOMv+F3qh+ZNHECipOJIbtTDJZJIi52 jdQc9tH02jkTltF63CDhf0njznyLXjDbXjuYXuZer2w8yyi4Z5WYGO9J1 FY81m5b1RrHz0RLn182JC3VcRFta2QD+FTE27nat9LOFv0JIC50R5fPKh d4q7aag5qvyoN7A5LAplMC7GZkbnh+/6Sl5EXx7N4ALvYSL065cRHHpq0 A==; X-IronPort-AV: E=McAfee;i="6600,9927,10984"; a="5049590" X-IronPort-AV: E=Sophos;i="6.06,161,1705392000"; d="scan'208";a="5049590" Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmvoesa107.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 15 Feb 2024 04:17:04 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10984"; a="912156788" X-IronPort-AV: E=Sophos;i="6.06,161,1705392000"; d="scan'208";a="912156788" Received: from smile.fi.intel.com ([10.237.72.54]) by fmsmga002.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 15 Feb 2024 04:17:02 -0800 Received: from andy by smile.fi.intel.com with local (Exim 4.97) (envelope-from ) id 1raafk-00000004mim-099p; Thu, 15 Feb 2024 14:17:00 +0200 Date: Thu, 15 Feb 2024 14:16:59 +0200 From: Andy Shevchenko To: Geert Uytterhoeven Cc: devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Rob Herring , Krzysztof Kozlowski , Conor Dooley , Robin van der Gracht , Paul Burton Subject: Re: [PATCH v2 10/15] auxdisplay: linedisp: Provide a small buffer in the struct linedisp Message-ID: References: <20240212170423.2860895-1-andriy.shevchenko@linux.intel.com> <20240212170423.2860895-11-andriy.shevchenko@linux.intel.com> Precedence: bulk X-Mailing-List: linux-kernel@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: Organization: Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo On Thu, Feb 15, 2024 at 11:40:44AM +0100, Geert Uytterhoeven wrote: > On Mon, Feb 12, 2024 at 6:04 PM Andy Shevchenko > wrote: .. > > + linedisp->buf = buf ? buf : linedisp->curr; > > + linedisp->num_chars = buf ? num_chars : min(num_chars, LINEDISP_DEFAULT_BUF_SZ); > > I think it would be safer to return an error if buf == NULL and > num_chars < LINEDISP_DEFAULT_BUF_SZ. I think you meant >= ? > Else a careless driver that doesn't check linedisp->num_chars might > overflow the buffer. Okay, check has been added. -- With Best Regards, Andy Shevchenko