Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp2564778yba; Sun, 28 Apr 2019 04:04:06 -0700 (PDT) X-Google-Smtp-Source: APXvYqz1hlxbu/RUIvxwV/O44BgAfP373Yc0hOOU1FMArxzAeAjkTh/Ie6nDa2UypPNX0WV6Yz4E X-Received: by 2002:a17:902:aa96:: with SMTP id d22mr16021402plr.259.1556449446241; Sun, 28 Apr 2019 04:04:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1556449446; cv=none; d=google.com; s=arc-20160816; b=iV42lsNiH8mK+eIs9+YRMx4Sd0ItqWmku4o4lr2xjwVFbtCeae0iRaRT3vhYtyDU0g SybmhF99/50e7sZwFnBvfdK211nUcseFwF34+LI+nGmz9KbN0UtuLUxxIyWP9mMSYcsq FgslLSYlWHjoFzXXSJfmKos7F20TbfP9OSmKhTJBLpvwkVfgOFSLhMv6KJD0oPFvI1fF /kZ+oTNU6+qA4ZN4VEynFJKe285A2T5vAaODsJk1BhiVyq6k1VJ/3OnJLr+17tzrkVYB YCDJ/2iw6XNQXzkWTI/DVq1E34Oj9JsFU97RupI8n4Qiv6lJQXeHLlP+k7liLJHdmYjU Dgrg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:message-id :in-reply-to:date:references:organization:subject:cc:to:from; bh=U/PjAcGo3A59nBJdvWflpY6RE/E7QtUVL+L/4LD3Zb0=; b=iB1ObShA9FkX0sLIshxUzeZjvjiTQ2OSDZrFXw5WZig7Z04yugUy7/8oY8xa+8uYXu XIq0olHEbXsWOIqueZk625d7Ia66i86Akj48qqdOK0vJrkSaQbNlhecsgcyIcMAyY+hh TOh4q9SFAcrK19Tbfvd4aV91f9Mr5IcPWUpejt3fur2FsNxmMb1fInvV41NTv6Hmht0B 1LulAPJivE+WfaEAaWpcow3DfPtyp0de5XFyi9BXjEPPsnmZRDVOSBZ1P9mgSafzrWfj MONvX9MBg7EYRAIha3NwIXKijpMR9Zap1h3oDPn3co4S4puwtgErINj++A3j1bNKG/do Tnog== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=collabora.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id b2si12128258pgh.159.2019.04.28.04.03.49; Sun, 28 Apr 2019 04:04:06 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=collabora.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726650AbfD1LCw (ORCPT + 99 others); Sun, 28 Apr 2019 07:02:52 -0400 Received: from bhuna.collabora.co.uk ([46.235.227.227]:46500 "EHLO bhuna.collabora.co.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726317AbfD1LCw (ORCPT ); Sun, 28 Apr 2019 07:02:52 -0400 Received: from localhost (unknown [IPv6:2605:8d80:523:7f9b:667e:c07a:4564:ffd6]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) (Authenticated sender: krisman) by bhuna.collabora.co.uk (Postfix) with ESMTPSA id 8E287270D92; Sun, 28 Apr 2019 12:02:49 +0100 (BST) From: Gabriel Krisman Bertazi To: Masahiro Yamada Cc: Olaf Weber , Gabriel Krisman Bertazi , "Theodore Ts'o" , Michal Marek , Linux Kbuild mailing list , Colin King , kernel-janitors@vger.kernel.org, Linux Kernel Mailing List Subject: Re: [PATCH][next] unicode: fix dereference of a potentially null pointer Organization: Collabora References: <20190426222237.13209-1-colin.king@canonical.com> Date: Sun, 28 Apr 2019 07:02:45 -0400 In-Reply-To: (Masahiro Yamada's message of "Sat, 27 Apr 2019 15:29:30 +0900") Message-ID: <85ef5mcrze.fsf@collabora.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.1 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Masahiro Yamada writes: > Forwarding because this file is not in my tree. > > > > > > On Sat, Apr 27, 2019 at 7:22 AM Colin King wrote: >> >> From: Colin Ian King >> >> The pointer 'tree' is deferenced when assigning pointer 'trie', however >> trie is being null checked a few lines later, so it could potentially >> be null. Fix the potential null pointer dereference by only dereferencing >> it after it has been null checked. >> >> Addresses-Coverity: ("Dereference before null check") >> Fixes: b08fcacaaaf4 ("unicode: introduce UTF-8 character database") >> Signed-off-by: Colin Ian King Acked-by: Gabriel Krisman Bertazi Ted, can you pick this up directly for now? >> --- >> scripts/mkutf8data.c | 3 ++- >> 1 file changed, 2 insertions(+), 1 deletion(-) >> >> diff --git a/scripts/mkutf8data.c b/scripts/mkutf8data.c >> index 12ce94b43be6..0563ba679bbb 100644 >> --- a/scripts/mkutf8data.c >> +++ b/scripts/mkutf8data.c >> @@ -2706,7 +2706,7 @@ static utf8leaf_t *utf8hangul(const char *str, unsigned char *hangul) >> static utf8leaf_t *utf8nlookup(struct tree *tree, unsigned char *hangul, >> const char *s, size_t len) >> { >> - utf8trie_t *trie = utf8data + tree->index; >> + utf8trie_t *trie; >> int offlen; >> int offset; >> int mask; >> @@ -2716,6 +2716,7 @@ static utf8leaf_t *utf8nlookup(struct tree *tree, unsigned char *hangul, >> return NULL; >> if (len == 0) >> return NULL; >> + trie = utf8data + tree->index; >> node = 1; >> while (node) { >> offlen = (*trie & OFFLEN) >> OFFLEN_SHIFT; >> -- >> 2.20.1 >> > > > -- > Best Regards > Masahiro Yamada -- Gabriel Krisman Bertazi