{"id":809073,"url":"http://patchwork.ozlabs.org/api/patches/809073/?format=json","web_url":"http://patchwork.ozlabs.org/project/uboot/patch/1504365337-32519-2-git-send-email-bmeng.cn@gmail.com/","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":"<1504365337-32519-2-git-send-email-bmeng.cn@gmail.com>","list_archive_url":null,"date":"2017-09-02T15:15:36","name":"[U-Boot,2/3] nvme: Fix potential sign extension issue in nvme_blk_rw()","commit_ref":"52a5690efb034c16e1a81b4124c55aa27e3e0138","pull_url":null,"state":"accepted","archived":false,"hash":"cb6906e1f1aa7a370297755f93a8a7a20ad5c07e","submitter":{"id":64981,"url":"http://patchwork.ozlabs.org/api/people/64981/?format=json","name":"Bin Meng","email":"bmeng.cn@gmail.com"},"delegate":{"id":3651,"url":"http://patchwork.ozlabs.org/api/users/3651/?format=json","username":"trini","first_name":"Tom","last_name":"Rini","email":"trini@ti.com"},"mbox":"http://patchwork.ozlabs.org/project/uboot/patch/1504365337-32519-2-git-send-email-bmeng.cn@gmail.com/mbox/","series":[{"id":1158,"url":"http://patchwork.ozlabs.org/api/series/1158/?format=json","web_url":"http://patchwork.ozlabs.org/project/uboot/list/?series=1158","date":"2017-09-02T15:15:35","name":"[U-Boot,1/3] nvme: Fix wrong ndev->queues memset","version":1,"mbox":"http://patchwork.ozlabs.org/series/1158/mbox/"}],"comments":"http://patchwork.ozlabs.org/api/patches/809073/comments/","check":"pending","checks":"http://patchwork.ozlabs.org/api/patches/809073/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>)","ozlabs.org;\n\tdkim=fail reason=\"signature verification failed\" (2048-bit key;\n\tunprotected) header.d=gmail.com header.i=@gmail.com\n\theader.b=\"vGm9mV6u\"; dkim-atps=neutral"],"Received":["from lists.denx.de (dione.denx.de [81.169.180.215])\n\tby ozlabs.org (Postfix) with ESMTP id 3xl02Q3C40z9t0F\n\tfor <incoming@patchwork.ozlabs.org>;\n\tSun,  3 Sep 2017 01:11:58 +1000 (AEST)","by lists.denx.de (Postfix, from userid 105)\n\tid 27669C21E92; Sat,  2 Sep 2017 15:11:37 +0000 (UTC)","from lists.denx.de (localhost [IPv6:::1])\n\tby lists.denx.de (Postfix) with ESMTP id C5BDEC21C5C;\n\tSat,  2 Sep 2017 15:11:18 +0000 (UTC)","by lists.denx.de (Postfix, from userid 105)\n\tid 80B2EC21DAD; Sat,  2 Sep 2017 15:11:17 +0000 (UTC)","from mail-it0-f65.google.com (mail-it0-f65.google.com\n\t[209.85.214.65])\n\tby lists.denx.de (Postfix) with ESMTPS id 02EA5C21C5C\n\tfor <u-boot@lists.denx.de>; Sat,  2 Sep 2017 15:11:17 +0000 (UTC)","by mail-it0-f65.google.com with SMTP id k189so1151277itk.1\n\tfor <u-boot@lists.denx.de>; Sat, 02 Sep 2017 08:11:16 -0700 (PDT)","from ala-d2121-lx1.wrs.com (unknown-156-139.windriver.com.\n\t[147.11.156.139]) by smtp.gmail.com with ESMTPSA id\n\tc8sm1372273ioj.53.2017.09.02.08.11.14\n\t(version=TLS1_1 cipher=ECDHE-RSA-AES128-SHA bits=128/128);\n\tSat, 02 Sep 2017 08:11:15 -0700 (PDT)"],"X-Spam-Checker-Version":"SpamAssassin 3.4.0 (2014-02-07) on lists.denx.de","X-Spam-Level":"","X-Spam-Status":"No, score=-0.0 required=5.0 tests=FREEMAIL_FROM,\n\tRCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL,\n\tT_DKIM_INVALID\n\tautolearn=unavailable autolearn_force=no version=3.4.0","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;\n\th=from:to:subject:date:message-id:in-reply-to:references;\n\tbh=We63RFE7VnMDxCxR1fkKM1bR9Lz6VcFwEfFiMjiSvBQ=;\n\tb=vGm9mV6umnRgNN72hDyQijADnUiHoG8IJeLc4Q5dEAN3mGvyPUKkxkADk+QqbhWjcF\n\t9ELYe5efzAix8Fyk/hJlgHe/tH4Oy3x04rGuJFeOIW/i1t4G/G+1TOwrBoxPCIVFGtRn\n\th0yJmJX1EixgdiqnKICg+ljLRn3NZJHYTU7KPIiFUbqzQdIYjsyv1XJcZfKQUusAPytE\n\tgOpxsPduWoQEDzee/njgK+iioUo4El5TIkrSiaw3ZhUlMmnLajFRTUkusy76oeANnXn0\n\tFd/MtRPxaiV3h1WJLkD8VpmQJjUPTQDo35zFu12rABJengV5axYXIl9oH2f04jqZMh2p\n\tDOqQ==","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20161025;\n\th=x-gm-message-state:from:to:subject:date:message-id:in-reply-to\n\t:references;\n\tbh=We63RFE7VnMDxCxR1fkKM1bR9Lz6VcFwEfFiMjiSvBQ=;\n\tb=HTfk5e8tzLCzgU4beKWIID/wYEre63HJA8xFTfjsKlc6bbKVB6U1WGQrhQ9RPh396R\n\tAbaEnjEGpA2fGp84oGbNlnR/DXtSleP9sIH88e0DAhkGB/I2LCc4zKiTl45wU6lOOpPv\n\tdFCaNAwXpomQpmKSQzr6xhpBCCfGN1GIhk8KVPEF9XNYA1y8mOSt4tgQvAo7QEd7Mdtk\n\t3XQwItlfSMitTGdFJParwJ62gsnAktgiO+tNyNssY/GoZtWokHDE+N9yWov41FrBj854\n\tttEki4YAOTTDdJ8BRshs6AK5/F1xyVHd3jReilu4thBTdO0KAzTniy14WN6Yup7nQKH6\n\tUYqQ==","X-Gm-Message-State":"AHPjjUihAia1scqtVKf89q7mMA5RxGMSSudMo/IA7xE/26FfUn3n7bBq\n\tghqOEcysjTSDoLdo","X-Google-Smtp-Source":"ADKCNb7RPa6GC+mXTvizYD2KunKgIWGCr4sK7k27zAlVu+8UngE9XvhugTu1cmMbsZakrE+YISvQBA==","X-Received":"by 10.36.216.8 with SMTP id b8mr1681799itg.55.1504365075977;\n\tSat, 02 Sep 2017 08:11:15 -0700 (PDT)","From":"Bin Meng <bmeng.cn@gmail.com>","To":"Tom Rini <trini@konsulko.com>, U-Boot Mailing List <u-boot@lists.denx.de>","Date":"Sat,  2 Sep 2017 08:15:36 -0700","Message-Id":"<1504365337-32519-2-git-send-email-bmeng.cn@gmail.com>","X-Mailer":"git-send-email 1.7.9.5","In-Reply-To":"<1504365337-32519-1-git-send-email-bmeng.cn@gmail.com>","References":"<1504365337-32519-1-git-send-email-bmeng.cn@gmail.com>","Subject":"[U-Boot] [PATCH 2/3] nvme: Fix potential sign extension issue in\n\tnvme_blk_rw()","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":"\"lbas\" with type \"u16\" (16 bits, unsigned) is promoted in\n\"lbas << ns->lba_shift\" to type \"int\" (32 bits, signed), then\nsign-extended to type \"unsigned long long\" (64 bits, unsigned).\nIf \"lbas << ns->lba_shift\" is greater than 0x7FFFFFFF, the upper\nbits of the result will all be 1.\n\nFix it by casting \"lbas\" to \"u32\".\n\nReported-by: Coverity (CID: 166730)\nSigned-off-by: Bin Meng <bmeng.cn@gmail.com>\n---\n\n drivers/nvme/nvme.c | 2 +-\n 1 file changed, 1 insertion(+), 1 deletion(-)","diff":"diff --git a/drivers/nvme/nvme.c b/drivers/nvme/nvme.c\nindex 4448754..59d54eb 100644\n--- a/drivers/nvme/nvme.c\n+++ b/drivers/nvme/nvme.c\n@@ -723,7 +723,7 @@ static ulong nvme_blk_rw(struct udevice *udev, lbaint_t blknr,\n \t\t\t\t&c, NULL, IO_TIMEOUT);\n \t\tif (status)\n \t\t\tbreak;\n-\t\ttemp_len -= lbas << ns->lba_shift;\n+\t\ttemp_len -= (u32)lbas << ns->lba_shift;\n \t\tbuffer += lbas << ns->lba_shift;\n \t}\n \n","prefixes":["U-Boot","2/3"]}