Received: by 2002:a05:6a10:6744:0:0:0:0 with SMTP id w4csp2702113pxu; Sun, 18 Oct 2020 12:03:29 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz9vU2zuRQMP2tnLFCHZaH8GbLErIQYgu69GP4i3ATBDag2N4PaepmO6oSkyqs5VBdREdGw X-Received: by 2002:a17:906:1a19:: with SMTP id i25mr13668224ejf.323.1603047809044; Sun, 18 Oct 2020 12:03:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1603047809; cv=none; d=google.com; s=arc-20160816; b=Uc0weT/6dfzYAltXxvo03vzDEBc5VGUzCS38xL6N/4mKB3foL/vZm0Xeu1NI+KbJb0 gN6rj6FbgHfVr8Hp27+PCsYC89RJgn6qYOQVZbkSPX3kO34Y8Hdk2R2grcGE/uOaQmay iXyO9JuGW67UnCTih01yyvjvYAnAz9YS7nbv6Vq2ZQyHztePc+VwB8XRrIbjwQWHBbtb ogLRs9xZzyhN/5EviuCctOh7aRJF5CMWwuKkVaosBuijUOOTdc/3JCLfcM2KHLIF1Kc/ B3D8JdkzSXYgXBBENP1D0IKmtHyxFkI0hahJBhsdJQY99K2uHNOgb+CzCInGX2oDseSN Klow== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=vDtrylS/RN/X5MfRBvgpYbyAlRSg7CP7eSTbD6n1oCk=; b=Qs2REd3e80iYx/9V1sITjc2881CyWwhCYPd2UKbcRyRtEtTUXKEYe/IEzoUcAyPgl5 MroYowpmbPf9buV+UJjEILUlJuypIWNfL2+adKd9p98LBQoecKkVkwUyVLH2KHHbKPN+ Iz89f1apUvoCBRLJemObVznhzzC1+oywvdkdYNGBkJcKKVBN8+HRZVQlFYm4TESihZXu q1kM+DVA56fzvaCQcDkF9Bf3pidiXCO1t7iL+s4o4ZX8IF6UI+Nj38ryMg5aSqupeteD Qg0rJk1WHOGDkBsMPmwuqNWPpBAfg9hQDgkFbEyXZHqmXZ7HyGZrdAKuhmk/NCs4aNzJ /5bg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=R8N2yrsi; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id y18si3727482edw.393.2020.10.18.12.03.07; Sun, 18 Oct 2020 12:03:29 -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=@gmail.com header.s=20161025 header.b=R8N2yrsi; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726844AbgJRSNq (ORCPT + 99 others); Sun, 18 Oct 2020 14:13:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50684 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725776AbgJRSNp (ORCPT ); Sun, 18 Oct 2020 14:13:45 -0400 Received: from mail-pj1-x1041.google.com (mail-pj1-x1041.google.com [IPv6:2607:f8b0:4864:20::1041]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 98DE9C061755; Sun, 18 Oct 2020 11:13:45 -0700 (PDT) Received: by mail-pj1-x1041.google.com with SMTP id az3so4068088pjb.4; Sun, 18 Oct 2020 11:13:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=vDtrylS/RN/X5MfRBvgpYbyAlRSg7CP7eSTbD6n1oCk=; b=R8N2yrsi/4FgJn1aT/zEzfuuimbi0iHQMrlYFVxTgxngsQUZrsfpszzkQRCNb3i8Xu n/SQc+RlIP+oFXu4KRPFSPlBQKRQhnFpc1vhOvDHvvnKDgFOe1R+veHAjuLrbhhQMspS /8dfaqardAtvM+LIcKRTi/WG9MpqYKO8rSZgrkFLwmZYwDDP5mjZpSoDJ8i2bNC6DNUy Y/bJDL5I86HA0erTJVjtQmn5Sm2M1wKqSDn3bVg1d70jd5SCHek1UVF2qrfnnb3VatiO EAJJnLMYwZ6CypDzSURAuDcmaRRqnwDDon1xhHtcX+14a/F6hCl4T7IGhVdII47GVMbB 0e5Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=vDtrylS/RN/X5MfRBvgpYbyAlRSg7CP7eSTbD6n1oCk=; b=dryTVmdYeFx/7GOkO5DDmjmbRGXz4AnjjgsPZ6M5a3rk/CmCslukix54xdUhtul3Tr yUmH3Z6USOzqVjO75a0cG9uuRQ/ZndjO7iIz6np+49kI7AP/00sRNz5v7CCHkYa7QPAb 84sR2ZijNdg+ncZdAMT0AtMXUjWXHyWRedbRNM4qu59+kEVOc/SvdY60YKvOsLZjvpQx dOiqErkA2otWZZeMrzsusHdLc+6XZaBlEtR8sWPUgy4X24AiqYS4k7Qe58BUE7VAzdl1 NS287DMMIJ7tM0SoEZI64CXOn30bIvOH5mi6PRNumzrd9LaLp5LuerGpJV3TaFba78Xv r2xg== X-Gm-Message-State: AOAM53226g2V6WbqwHnPR0kpbvv+56UYm+J3A7elXalimx+ErYKj/gRC ZUqWGRVUahIAXqG8aCHFoQ== X-Received: by 2002:a17:90a:a111:: with SMTP id s17mr14271776pjp.28.1603044825029; Sun, 18 Oct 2020 11:13:45 -0700 (PDT) Received: from localhost.localdomain ([161.117.41.183]) by smtp.gmail.com with ESMTPSA id hi22sm9783054pjb.21.2020.10.18.11.13.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 18 Oct 2020 11:13:44 -0700 (PDT) From: Peilin Ye To: Daniel Vetter , Greg Kroah-Hartman Cc: Bartlomiej Zolnierkiewicz , Sascha Hauer , Sven Schneider , Pengutronix Kernel Team , linux-fbdev@vger.kernel.org, linux-kernel@vger.kernel.org, Peilin Ye Subject: [PATCH 1/2] Fonts: Support FONT_EXTRA_WORDS macros for font_6x8 Date: Sun, 18 Oct 2020 14:12:04 -0400 Message-Id: <926453876c92caac34cba8545716a491754d04d5.1603037079.git.yepeilin.cs@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200820082137.5907-1-s.hauer@pengutronix.de> References: <20200820082137.5907-1-s.hauer@pengutronix.de> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 --- 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