From nobody Fri May 17 19:59:44 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=oracle.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 155319938948792.85862152296943; Thu, 21 Mar 2019 13:16:29 -0700 (PDT) Received: from localhost ([127.0.0.1]:46286 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h7470-00026X-3v for importer@patchew.org; Thu, 21 Mar 2019 16:16:26 -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 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 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== 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+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" 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 analysi= s. 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 =3D bios_linker_find_file(linker, src_file); =20 + assert(dst_file); + assert(source_file); assert(dst_patched_offset < dst_file->blob->len); assert(dst_patched_offset + dst_patched_size <=3D dst_file->blob->len); assert(src_offset < source_file->blob->len); --=20 1.8.3.1