{"id":795425,"url":"http://patchwork.ozlabs.org/api/patches/795425/?format=json","web_url":"http://patchwork.ozlabs.org/project/uboot/patch/20170730195923.22264-1-xypron.glpk@gmx.de/","project":{"id":18,"url":"http://patchwork.ozlabs.org/api/projects/18/?format=json","name":"U-Boot","link_name":"uboot","list_id":"u-boot.lists.denx.de","list_email":"u-boot@lists.denx.de","web_url":null,"scm_url":null,"webscm_url":null,"list_archive_url":"","list_archive_url_format":"","commit_url_format":""},"msgid":"<20170730195923.22264-1-xypron.glpk@gmx.de>","list_archive_url":null,"date":"2017-07-30T19:59:23","name":"[U-Boot,1/1] lcd: avoid possible NULL dereference","commit_ref":"021414a33248f9c1f6eb4a676f4a1fbcfa26f475","pull_url":null,"state":"accepted","archived":false,"hash":"95793e8abb84c249d87dcd5d492f0cfc7d146e79","submitter":{"id":61270,"url":"http://patchwork.ozlabs.org/api/people/61270/?format=json","name":"Heinrich Schuchardt","email":"xypron.glpk@gmx.de"},"delegate":{"id":1700,"url":"http://patchwork.ozlabs.org/api/users/1700/?format=json","username":"ag","first_name":"Anatolij","last_name":"Gustschin","email":"agust@denx.de"},"mbox":"http://patchwork.ozlabs.org/project/uboot/patch/20170730195923.22264-1-xypron.glpk@gmx.de/mbox/","series":[],"comments":"http://patchwork.ozlabs.org/api/patches/795425/comments/","check":"pending","checks":"http://patchwork.ozlabs.org/api/patches/795425/checks/","tags":{},"related":[],"headers":{"Return-Path":"<u-boot-bounces@lists.denx.de>","X-Original-To":"incoming@patchwork.ozlabs.org","Delivered-To":"patchwork-incoming@bilbo.ozlabs.org","Authentication-Results":"ozlabs.org;\n\tspf=none (mailfrom) smtp.mailfrom=lists.denx.de\n\t(client-ip=81.169.180.215; helo=lists.denx.de;\n\tenvelope-from=u-boot-bounces@lists.denx.de;\n\treceiver=<UNKNOWN>)","Received":["from lists.denx.de (dione.denx.de [81.169.180.215])\n\tby ozlabs.org (Postfix) with ESMTP id 3xLD266fdjz9s83\n\tfor <incoming@patchwork.ozlabs.org>;\n\tMon, 31 Jul 2017 05:59:42 +1000 (AEST)","by lists.denx.de (Postfix, from userid 105)\n\tid B09ABC21E5A; Sun, 30 Jul 2017 19:59:38 +0000 (UTC)","from lists.denx.de (localhost [IPv6:::1])\n\tby lists.denx.de (Postfix) with ESMTP id 2A6CAC21D8D;\n\tSun, 30 Jul 2017 19:59:36 +0000 (UTC)","by lists.denx.de (Postfix, from userid 105)\n\tid 3639FC21D8D; Sun, 30 Jul 2017 19:59:34 +0000 (UTC)","from mout.gmx.net (mout.gmx.net [212.227.15.15])\n\tby lists.denx.de (Postfix) with ESMTPS id DC205C21C58\n\tfor <u-boot@lists.denx.de>; Sun, 30 Jul 2017 19:59:33 +0000 (UTC)","from LT002.fritz.box ([84.118.154.110]) by mail.gmx.com (mrgmx001\n\t[212.227.17.190]) with ESMTPSA (Nemesis) id\n\t0M8NBi-1dokCJ2U5q-00vy56; Sun, 30 Jul 2017 21:59:29 +0200"],"X-Spam-Checker-Version":"SpamAssassin 3.4.0 (2014-02-07) on lists.denx.de","X-Spam-Level":"","X-Spam-Status":"No, score=-0.7 required=5.0 tests=FREEMAIL_FROM,\n\tRCVD_IN_DNSWL_LOW,\n\tRCVD_IN_MSPIKE_H2 autolearn=unavailable autolearn_force=no\n\tversion=3.4.0","From":"Heinrich Schuchardt <xypron.glpk@gmx.de>","To":"Simon Glass <sjg@chromium.org>","Date":"Sun, 30 Jul 2017 21:59:23 +0200","Message-Id":"<20170730195923.22264-1-xypron.glpk@gmx.de>","X-Mailer":"git-send-email 2.11.0","X-Provags-ID":"V03:K0:xZd3ddlD4OUokiSOgh1CLUNbKzYZ2bpYqRfN/qQoz15R/Ka+ceh\n\tSqX2XTo2OB+cFp6te6r2zucasoSQkZbffWEniuDUSftirymq/+01l4CA6B6uCPcWT/H/wNL\n\tBm2qPe/BP64Aa6e5tMMOkSjBzLUndTeDcx4EooyYYQR8D0DDWccTf4EJDg5rG2fS/HzrT/1\n\tn3S9zbnPqQy2+U8wUszqA==","X-UI-Out-Filterresults":"notjunk:1; V01:K0:F+e1MPEiRxA=:nbE9CqOJvAqlz7BctQtws9\n\tKbgBI2gEtEofynVjDMZUExqfvMOZxdf9zmqDsdeMSZslnNgLjZIkOoO5XEbQBJ0WJ5ppxBYNj\n\tgXCj8o115ApMX6/LbCbtrygnOBAm0p9gLmKV+6BwHs8cpFsQI/mL7Yk5L+eCbBmxxEWPXhmjP\n\tsYpcLsTDGRAMEyQHd52QQwxmeYVyaInZq8uroPPeAZRv9QEsBSsJu0DUoyRjFdUD5g2ueM3H8\n\todfWhD4sTEWi4MP0AHKW03bV0UQprDKrkFuoxtCH3Ub0N8VsVFh6pZncwQOIMFJBpsgMwAsv4\n\tUPa+YYytjmUixipuf1rT1bwslcwrw8LlqqUS3UaRh2T2oYOtrXPb3yvfUAriPvlnuNWdLw0kF\n\ttrYN394j4zglLh2EFQ2UvajgzVy8JTfPgYolRtS8o9wlAaGfqZord45E9wR6RSBwiSgkf35yx\n\tqChVWR/+bibRDSZz5DyR3cHnojbKU1Q5+++VRhNulFHXAGJC5Gtx6SGAoFjjN+AvWrYJDTHhe\n\tzVc0XbwGqxl2+aslPTfBAnhEeuT/Y6DaohNwV87EoFqi/x9pnHDcrI0yvoGIzaVMf5uQM62vd\n\tSZvaRpiW13AemXopybs0DjoxF1YH/kAWkcVUEBE3uzwPo9T23T6Xc5jtt6fnBloBDgHytUZNZ\n\t4fQB49P2y6iq0yYcCmMaYUg62xHoxh9/U5KMYh6pMV3TJWigYWGZP1beU8qrL0d460I0KUiuG\n\tK8ZPfUOoBTVjKAYTWgEztC2EV128wLfl25nnj7hxFMcKacEBC7AeYC4z97FqcEqnsKjH0NI/V\n\tkgmpbg6mQkdF8iDPXh8FH2xAel0dA==","Cc":"u-boot@lists.denx.de, Heinrich Schuchardt <xypron.glpk@gmx.de>","Subject":"[U-Boot] [PATCH 1/1] lcd: avoid possible NULL dereference","X-BeenThere":"u-boot@lists.denx.de","X-Mailman-Version":"2.1.18","Precedence":"list","List-Id":"U-Boot discussion <u-boot.lists.denx.de>","List-Unsubscribe":"<https://lists.denx.de/options/u-boot>,\n\t<mailto:u-boot-request@lists.denx.de?subject=unsubscribe>","List-Archive":"<http://lists.denx.de/pipermail/u-boot/>","List-Post":"<mailto:u-boot@lists.denx.de>","List-Help":"<mailto:u-boot-request@lists.denx.de?subject=help>","List-Subscribe":"<https://lists.denx.de/listinfo/u-boot>,\n\t<mailto:u-boot-request@lists.denx.de?subject=subscribe>","MIME-Version":"1.0","Content-Type":"text/plain; charset=\"utf-8\"","Content-Transfer-Encoding":"base64","Errors-To":"u-boot-bounces@lists.denx.de","Sender":"\"U-Boot\" <u-boot-bounces@lists.denx.de>"},"content":"Do not dereference bmp before the check if it is NULL.\n\nThe problem was indicated by cppcheck.\n\nSigned-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>\n---\n common/lcd.c | 3 ++-\n 1 file changed, 2 insertions(+), 1 deletion(-)","diff":"diff --git a/common/lcd.c b/common/lcd.c\nindex 7e399cee2d..35914960a5 100644\n--- a/common/lcd.c\n+++ b/common/lcd.c\n@@ -578,7 +578,7 @@ int lcd_display_bitmap(ulong bmp_image, int x, int y)\n \tunsigned long pwidth = panel_info.vl_col;\n \tunsigned colors, bpix, bmp_bpix;\n \tint hdr_size;\n-\tstruct bmp_color_table_entry *palette = bmp->color_table;\n+\tstruct bmp_color_table_entry *palette;\n \n \tif (!bmp || !(bmp->header.signature[0] == 'B' &&\n \t\tbmp->header.signature[1] == 'M')) {\n@@ -587,6 +587,7 @@ int lcd_display_bitmap(ulong bmp_image, int x, int y)\n \t\treturn 1;\n \t}\n \n+\tpalette = bmp->color_table;\n \twidth = get_unaligned_le32(&bmp->header.width);\n \theight = get_unaligned_le32(&bmp->header.height);\n \tbmp_bpix = get_unaligned_le16(&bmp->header.bit_count);\n","prefixes":["U-Boot","1/1"]}