Show a patch.

GET /api/1.1/patches/3979/?format=api
HTTP 200 OK
Allow: GET, PUT, PATCH, HEAD, OPTIONS
Content-Type: application/json
Vary: Accept

{
    "id": 3979,
    "url": "https://patchwork.libcamera.org/api/1.1/patches/3979/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/3979/",
    "project": {
        "id": 1,
        "url": "https://patchwork.libcamera.org/api/1.1/projects/1/?format=api",
        "name": "libcamera",
        "link_name": "libcamera",
        "list_id": "libcamera_core",
        "list_email": "libcamera-devel@lists.libcamera.org",
        "web_url": "",
        "scm_url": "",
        "webscm_url": ""
    },
    "msgid": "<20200607143012.17752-3-email@uajain.com>",
    "date": "2020-06-07T14:30:18",
    "name": "[libcamera-devel,v3,2/2] libcamera: ipa_module: Fix implicit sign-extension in elfSection",
    "commit_ref": "79d666247182b0e42560ab505c29173ca94bdbb0",
    "pull_url": null,
    "state": "accepted",
    "archived": false,
    "hash": "f72735bdbfac6fefa1d49a22aaa0d8b083fe6b2c",
    "submitter": {
        "id": 1,
        "url": "https://patchwork.libcamera.org/api/1.1/people/1/?format=api",
        "name": "Umang Jain",
        "email": "email@uajain.com"
    },
    "delegate": null,
    "mbox": "https://patchwork.libcamera.org/patch/3979/mbox/",
    "series": [
        {
            "id": 967,
            "url": "https://patchwork.libcamera.org/api/1.1/series/967/?format=api",
            "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=967",
            "date": "2020-06-07T14:30:17",
            "name": "Fix implicit sign extension",
            "version": 3,
            "mbox": "https://patchwork.libcamera.org/series/967/mbox/"
        }
    ],
    "comments": "https://patchwork.libcamera.org/api/patches/3979/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/3979/checks/",
    "tags": {},
    "headers": {
        "Return-Path": "<bounces+15657259-5c31-libcamera-devel=lists.libcamera.org@em7280.uajain.com>",
        "Received": [
            "from o1.f.az.sendgrid.net (o1.f.az.sendgrid.net [208.117.55.132])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id DB45F61626\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tSun,  7 Jun 2020 16:30:20 +0200 (CEST)",
            "by filter0135p3las1.sendgrid.net with SMTP id\n\tfilter0135p3las1-9010-5EDCF9FA-1E7\n\t2020-06-07 14:30:18.733685738 +0000 UTC m=+400000.314394105",
            "from mail.uajain.com (unknown)\n\tby ismtpd0004p1maa1.sendgrid.net (SG) with ESMTP\n\tid hZX9YxZ2QLakbeVOk4GZ1A Sun, 07 Jun 2020 14:30:18.366 +0000 (UTC)"
        ],
        "Authentication-Results": "lancelot.ideasonboard.com; dkim=pass (1024-bit key; \n\tunprotected) header.d=uajain.com\n\theader.i=@uajain.com header.b=\"ilUeU8Yt\"; \n\tdkim-atps=neutral",
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed; d=uajain.com;\n\th=from:subject:in-reply-to:references:mime-version:to:cc:\n\tcontent-transfer-encoding:content-type;\n\ts=s1; bh=TBjKum+DY72wRVegSwltHxRqXC6J1KGz1NRSRIej3YA=;\n\tb=ilUeU8YtnH9Hm/d93w7cqE3Ub6v05B/h962j3OLBHket7cQ+c26OPakAl6YHH9yXJ2gx\n\tAoGe2JU9ZBMUIpZZjVYcC70oct4vYkKaajRNb6Nu9ibwk2FhUL6xumhoiBzLYVAIpb+yES\n\tM+u7+LM4bNcFOzxDNXEc82oFuteyzNxVY=",
        "From": "Umang Jain <email@uajain.com>",
        "Date": "Sun, 07 Jun 2020 14:30:18 +0000 (UTC)",
        "Message-Id": "<20200607143012.17752-3-email@uajain.com>",
        "In-Reply-To": "<20200607143012.17752-1-email@uajain.com>",
        "References": "<20200607143012.17752-1-email@uajain.com>",
        "Mime-Version": "1.0",
        "X-SG-EID": "1Q40EQ7YGir8a9gjSIAdTjhngY657NMk9ckeo4dbHZDiOpywc/L3L9rFqlwE4KPcAl6MTtKrYqN2BGXS9ZDVMf59817yL7+3nHWtUAHR16ne0RQ/mUc/NqTkjCEkd4+DGgj+PD3r5a3rDZOXWMtKRFLnYILa6UC3bnQ8P6hJpXmdvr3TSOLz3jLmvSOR51R92r8OXVUboaIHWmksjTjZXoG/OpGi1c8GL7EwSbFK4Ytdb3/oHKCNGMXxSRsnOHOR",
        "To": "laurent.pinchart@ideasonboard.com, libcamera-devel@lists.libcamera.org, \n\tkieran.bingham@ideasonboard.com",
        "Content-Transfer-Encoding": "7bit",
        "Content-Type": "text/plain; charset=us-ascii",
        "Subject": "[libcamera-devel] [PATCH v3 2/2] libcamera: ipa_module: Fix\n\timplicit sign-extension in elfSection",
        "X-BeenThere": "libcamera-devel@lists.libcamera.org",
        "X-Mailman-Version": "2.1.29",
        "Precedence": "list",
        "List-Id": "<libcamera-devel.lists.libcamera.org>",
        "List-Unsubscribe": "<https://lists.libcamera.org/options/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=unsubscribe>",
        "List-Archive": "<https://lists.libcamera.org/pipermail/libcamera-devel/>",
        "List-Post": "<mailto:libcamera-devel@lists.libcamera.org>",
        "List-Help": "<mailto:libcamera-devel-request@lists.libcamera.org?subject=help>",
        "List-Subscribe": "<https://lists.libcamera.org/listinfo/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=subscribe>",
        "X-List-Received-Date": "Sun, 07 Jun 2020 14:30:22 -0000"
    },
    "content": "Given how the elfSection() is used the sub-expression\n       (idx * eHdr->e_shentsize)\nit has effectively two (16 bits, unsigned) operands.\nThe sub-expression is promoted to type int (32 bits, signed) for\nmultiplication and then added to eHdr->e_shoff, which is uint32_t\non 32-bit platforms and uint64_t on 64-bit platforms. Since eHdr->e_shoff\nis unsigned, the integer conversion rules dictates that the other signed\noperand(i.e. the resultant of aforementioned sub-expression) will be\nconverted to unsigned type too. This causes sign-extension for both of\nthe above operands to match eHdr->e_shoff's type and should be avoided.\n\nThe solution is to explicitly cast one of the operands of the\nsub-expression with unsigned int type. Hence, the other operand will be\ninteger promoted and the resultant will also be of unsigned int type,\nnot requiring to bother about a sign-extension.\n\nReported-by: Coverity CID=280008\nReported-by: Coverity CID=280009\nReported-by: Coverity CID=280010\nSigned-off-by: Umang Jain <email@uajain.com>\nReviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\n---\n src/libcamera/ipa_module.cpp | 3 ++-\n 1 file changed, 2 insertions(+), 1 deletion(-)",
    "diff": "diff --git a/src/libcamera/ipa_module.cpp b/src/libcamera/ipa_module.cpp\nindex 60aaa34..72e357e 100644\n--- a/src/libcamera/ipa_module.cpp\n+++ b/src/libcamera/ipa_module.cpp\n@@ -93,7 +93,8 @@ ElfW(Shdr) *elfSection(Span<uint8_t> elf, ElfW(Ehdr) *eHdr, ElfW(Half) idx)\n \tif (idx >= eHdr->e_shnum)\n \t\treturn nullptr;\n \n-\toff_t offset = eHdr->e_shoff + idx * eHdr->e_shentsize;\n+\toff_t offset = eHdr->e_shoff + idx *\n+\t\t\t\t       static_cast<uint32_t>(eHdr->e_shentsize);\n \treturn elfPointer<ElfW(Shdr)>(elf, offset);\n }\n \n",
    "prefixes": [
        "libcamera-devel",
        "v3",
        "2/2"
    ]
}