From patchwork Thu Mar 21 20:13:49 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Liam Merwick X-Patchwork-Id: 10864275 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 641E7922 for ; Thu, 21 Mar 2019 20:16:00 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 404792A485 for ; Thu, 21 Mar 2019 20:16:00 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 33D432A487; Thu, 21 Mar 2019 20:16:00 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.7 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,UNPARSEABLE_RELAY autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id BB6182A485 for ; Thu, 21 Mar 2019 20:15:59 +0000 (UTC) Received: from localhost ([127.0.0.1]:46286 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h746Y-00026X-68 for patchwork-qemu-devel@patchwork.kernel.org; Thu, 21 Mar 2019 16:15:58 -0400 Received: from eggs.gnu.org ([209.51.188.92]:39133) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h745J-00010C-7i for qemu-devel@nongnu.org; Thu, 21 Mar 2019 16:14:42 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1h745I-00068o-3s for qemu-devel@nongnu.org; Thu, 21 Mar 2019 16:14:41 -0400 Received: from userp2130.oracle.com ([156.151.31.86]:38318) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1h745H-000653-K5 for qemu-devel@nongnu.org; Thu, 21 Mar 2019 16:14:40 -0400 Received: from pps.filterd (userp2130.oracle.com [127.0.0.1]) by userp2130.oracle.com (8.16.0.27/8.16.0.27) with SMTP id x2LKE0HM096415; Thu, 21 Mar 2019 20:14:37 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id; s=corp-2018-07-02; bh=/TJfR9pN1iPVgS152V8dSrAlo8IwjifSCjN1HJIA3lU=; b=ENBKPuT3IHzDcHKqnhs4SkoG83wf46zM26ftP/PlZuHv3DPWPrrynLMETBt4nYxFtnxX n4nKzBj/5gNYBhGQBxld23KX5J4brFHgOB0EnERoI5sQd0/J0cNVQQpCiGLh3vNI8I6P QE8ntKH7txa4lE627OxgEHHYJuUv94oAny7wi13WDQ9OxxDSCbvPYwBHYFnR0A9KsQSD R27b1zeR/5zZB0toVOYm2knRIyO8NGgn8cyIJZeUx6NsqQp5gAK8fqBZM0K7M0T9tagt GF8qer9rO4K3IKR24LNaI1L6v5TIFbn8jB2pa4V/fXXhMMgUcsOHAQjFBB1+V+vQBu5t MQ== Received: from userv0022.oracle.com (userv0022.oracle.com [156.151.31.74]) by userp2130.oracle.com with ESMTP id 2r8rjv2p1x-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 21 Mar 2019 20:14:37 +0000 Received: from aserv0121.oracle.com (aserv0121.oracle.com [141.146.126.235]) by userv0022.oracle.com (8.14.4/8.14.4) with ESMTP id x2LKEVkr013972 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 21 Mar 2019 20:14:32 GMT Received: from abhmp0016.oracle.com (abhmp0016.oracle.com [141.146.116.22]) by aserv0121.oracle.com (8.14.4/8.13.8) with ESMTP id x2LKEVwQ027450; Thu, 21 Mar 2019 20:14:31 GMT Received: from ol7.nl.oracle.com (/10.175.16.58) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Thu, 21 Mar 2019 13:14:31 -0700 From: Liam Merwick To: mst@redhat.com, imammedo@redhat.com, qemu-devel@nongnu.org Date: Thu, 21 Mar 2019 20:13:49 +0000 Message-Id: <1553199229-25318-1-git-send-email-liam.merwick@oracle.com> X-Mailer: git-send-email 1.8.3.1 X-Proofpoint-Virus-Version: vendor=nai engine=5900 definitions=9202 signatures=668685 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 priorityscore=1501 malwarescore=0 suspectscore=0 phishscore=0 bulkscore=0 spamscore=0 clxscore=1011 lowpriorityscore=0 mlxscore=0 impostorscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1810050000 definitions=main-1903210142 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [generic] X-Received-From: 156.151.31.86 Subject: [Qemu-devel] [PATCH] acpi: verify file entries in bios_linker_loader_add_pointer() X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP The callers to bios_linker_find_file() assert that the file entry returned is not NULL, except for those in bios_linker_loader_add_pointer(). Add two asserts in that case for completeness and to facilitate static code analysis. Signed-off-by: Liam Merwick Reviewed-by: Igor Mammedov --- hw/acpi/bios-linker-loader.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/hw/acpi/bios-linker-loader.c b/hw/acpi/bios-linker-loader.c index d16b8bbcb187..626c04a39f92 100644 --- a/hw/acpi/bios-linker-loader.c +++ b/hw/acpi/bios-linker-loader.c @@ -283,6 +283,8 @@ void bios_linker_loader_add_pointer(BIOSLinker *linker, const BiosLinkerFileEntry *source_file = bios_linker_find_file(linker, src_file); + assert(dst_file); + assert(source_file); assert(dst_patched_offset < dst_file->blob->len); assert(dst_patched_offset + dst_patched_size <= dst_file->blob->len); assert(src_offset < source_file->blob->len);