Received: by 2002:a05:6a10:6744:0:0:0:0 with SMTP id w4csp2729910pxu; Sun, 18 Oct 2020 13:11:48 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwoPx35QCp8lUs/p7W5U+TVYiqG8nYDTk+Gg6cYd5X+o7tCGEJ8PHK3ARt5elfhTzt/BIFq X-Received: by 2002:a17:906:44a:: with SMTP id e10mr14484291eja.401.1603051907992; Sun, 18 Oct 2020 13:11:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1603051907; cv=none; d=google.com; s=arc-20160816; b=Sty4ZKdOp6FwfEm2TlW7bmitEL171nk2cHYBlDeZ2O5YE53xfycUOmk4cXKCKc/5/M RuCaD5k/4Wdmtd2YdApUKNyNzgl72kIwAN7YKlDXAoHdUQXd1843Lebw/l2/2pRHMqNH JvGchg64RYoISbT/jovt7Mga7Yet+5niz+T8AZB0vNuwT5Nu6StPUcVgTZ/IbYK24B2Q knxhSgSfYFdgqTleeP7T6b4BG5Z0+Qezbbl3CKqhth6bsIYjI2BP9383wiKVuE+ksCQT DwAAvcgKwqvl8WsXqBaPcgMjlnyqLYLD2qXHWXzU+9HFXOV0le+EqsH6XSHwrwwuvrd8 S3+A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=uTkIKpAXXUMsdDW0M0pmci3ckhN0Y57VkQTrzhAampI=; b=huS9L2bP+il5nDILV8wcVxSFVD1eUJbLu6Kwstkc365IDvdmJWaoMea2u4BSi09xZ0 bgewf+zq63zPQGAoLIP8vsM5n2FhFihDvp6grpHmFcZzFH35OwEC+zYevYj5RG2JNDjB tcEwQCuMd0/VDPq7VS0nZ72mkKFZ+VU0/JAWrkZIBY6HU9C5hvA7HZfJ+tDT8OQ5iLqx hhXJQF3l7qUXDlAhMKtsdYLjt0cM4e3sNz1GxBcEpphpu8xahcWDx7S22kj7qkSI8brY 0qOSSssZ76JYwKTyJzQD6/C+xMJpj26291w5ANIDdWp8Fp8NYukkBZ5TQRG6ohYw2R4j 8Wng== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ffwll.ch header.s=google header.b=ZWCwRmzA; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id d21si6401554edp.484.2020.10.18.13.11.25; Sun, 18 Oct 2020 13:11:47 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@ffwll.ch header.s=google header.b=ZWCwRmzA; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727690AbgJRUJS (ORCPT + 99 others); Sun, 18 Oct 2020 16:09:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40290 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726422AbgJRUJS (ORCPT ); Sun, 18 Oct 2020 16:09:18 -0400 Received: from mail-ot1-x341.google.com (mail-ot1-x341.google.com [IPv6:2607:f8b0:4864:20::341]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CC8BAC061755 for ; Sun, 18 Oct 2020 13:09:17 -0700 (PDT) Received: by mail-ot1-x341.google.com with SMTP id f10so8490908otb.6 for ; Sun, 18 Oct 2020 13:09:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ffwll.ch; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=uTkIKpAXXUMsdDW0M0pmci3ckhN0Y57VkQTrzhAampI=; b=ZWCwRmzA1q9rUb7p8BjxAG+i4vhfm41OiL5T5ZG1GnAzhlOaxO4waXtz1aznqqxQm5 /oy0veyH2tbq9YBXGF14heMaLwtJ2uC0ylKJ28Fv5bQAY4Xf9NljJvappbUUvvslOsUF n/y7UMXZeAkHNZVGiFW/izHWH2KpsQ+bkOwXw= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=uTkIKpAXXUMsdDW0M0pmci3ckhN0Y57VkQTrzhAampI=; b=J3hh8od2JmAsydkUp7LaNzSW3F0KXaTcDuFaBkaCOfnvwv6gVNXrLmnMGbcrK+PIEk OXSZSv0dpKk31+FZEJ24VxGpFXy/7uAgcrZV2A7XdDbqW+wC7T9Co/xc9faHY3Jwp44V Bh0pOl5H4mozy/1X7SH8dJ+Hoa/KttvXNNVdjaSEg1MePXCJ6Rh7JaYkmE2RHw3vkWlz nUqmDXuCZduRhTvMNPwccvnLWWr+FLbpVKtqBfSLjdxGxn8tSr+kFiCP6G+SwmEK4RRU /ZzBRtR+VRA/s30zsTkiOY3twjApjFP3fc3ZCqPuNYuI04yKwTMWIw+qVEVxJCNK9t9j Z4CQ== X-Gm-Message-State: AOAM533uJMqqEfu3RQUMxd35O/UB5RKaAH5hR9RFo3arIcW+uT504XdV ScVWPq5Bb7uHt2q6vWXZ8pstIFo4d3AJE/PNlbuS3w== X-Received: by 2002:a05:6830:8b:: with SMTP id a11mr9517320oto.303.1603051757215; Sun, 18 Oct 2020 13:09:17 -0700 (PDT) MIME-Version: 1.0 References: <20200820082137.5907-1-s.hauer@pengutronix.de> <926453876c92caac34cba8545716a491754d04d5.1603037079.git.yepeilin.cs@gmail.com> In-Reply-To: <926453876c92caac34cba8545716a491754d04d5.1603037079.git.yepeilin.cs@gmail.com> From: Daniel Vetter Date: Sun, 18 Oct 2020 22:09:06 +0200 Message-ID: Subject: Re: [PATCH 1/2] Fonts: Support FONT_EXTRA_WORDS macros for font_6x8 To: Peilin Ye , dri-devel Cc: Greg Kroah-Hartman , Bartlomiej Zolnierkiewicz , Sascha Hauer , Sven Schneider , Pengutronix Kernel Team , Linux Fbdev development list , Linux Kernel Mailing List Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Adding dri-devel too, not sure anyone is still listening on linux-fbdev. On Sun, Oct 18, 2020 at 8:13 PM Peilin Ye wrote: > > Recently, in commit 6735b4632def ("Fonts: Support FONT_EXTRA_WORDS macros > for built-in fonts"), we wrapped each of our built-in data buffers in a > `font_data` structure, in order to use the following macros on them, see > include/linux/font.h: > > #define REFCOUNT(fd) (((int *)(fd))[-1]) > #define FNTSIZE(fd) (((int *)(fd))[-2]) > #define FNTCHARCNT(fd) (((int *)(fd))[-3]) > #define FNTSUM(fd) (((int *)(fd))[-4]) > > #define FONT_EXTRA_WORDS 4 > > Do the same thing to our new 6x8 font. For built-in fonts, currently we > only use FNTSIZE(). Since this is only a temporary solution for an > out-of-bounds issue in the framebuffer layer (see commit 5af08640795b > ("fbcon: Fix global-out-of-bounds read in fbcon_get_font()")), all the > three other fields are intentionally set to zero in order to discourage > using these negative-indexing macros. > > Signed-off-by: Peilin Ye Patch looks good to me, but it says 1/2 and I can't find 2/2 anywhere, not even on lore. Did that get lost? -Daniel > --- > lib/fonts/font_6x8.c | 8 ++++---- > 1 file changed, 4 insertions(+), 4 deletions(-) > > diff --git a/lib/fonts/font_6x8.c b/lib/fonts/font_6x8.c > index e06447788418..700039a9ceae 100644 > --- a/lib/fonts/font_6x8.c > +++ b/lib/fonts/font_6x8.c > @@ -3,8 +3,8 @@ > > #define FONTDATAMAX 2048 > > -static const unsigned char fontdata_6x8[FONTDATAMAX] = { > - > +static struct font_data fontdata_6x8 = { > + { 0, 0, FONTDATAMAX, 0 }, { > /* 0 0x00 '^@' */ > 0x00, /* 000000 */ > 0x00, /* 000000 */ > @@ -2564,13 +2564,13 @@ static const unsigned char fontdata_6x8[FONTDATAMAX] = { > 0x00, /* 000000 */ > 0x00, /* 000000 */ > 0x00, /* 000000 */ > -}; > +} }; > > const struct font_desc font_6x8 = { > .idx = FONT6x8_IDX, > .name = "6x8", > .width = 6, > .height = 8, > - .data = fontdata_6x8, > + .data = fontdata_6x8.data, > .pref = 0, > }; > -- > 2.25.1 > -- Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch