From patchwork Tue Aug 10 12:18:39 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gerd Hoffmann X-Patchwork-Id: 494348 Delivered-To: patch@linaro.org Received: by 2002:a05:6638:396:0:0:0:0 with SMTP id y22csp3896656jap; Tue, 10 Aug 2021 05:22:56 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzMSkZBxUDHfFsh6x6I96DCf9NwwxCSn0qDRooAx/5/3sSj06JouV7MZ0cF9kgpWmNxhoow X-Received: by 2002:a1f:a102:: with SMTP id k2mr18133974vke.4.1628598176430; Tue, 10 Aug 2021 05:22:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1628598176; cv=none; d=google.com; s=arc-20160816; b=asr27ZexEQneeCeUk2QCaQi0Wu9EAA6K2UHSWuZDR6ipbAX5QWPXt56V1GxzFfu9Rr i/1gZcKKG1HZcfCUGrydNMjjkWPYXdOyMTNgVewuQwDT2zAeGcvCBruD7nKupSaasJwS ummRfpc2EvdQ59USbuORm5mHMKpsSv68uHDSflP4Khi8vz+PIWx4wHRt6xrs/utnxYoQ si6hye35e3UzpLBxkRf9FnsYdsPuJo1BezeuWkqbAoaYZMtyeyAP/u6qB4H2VYqVcE1A oLXkBoUW1QpibofMJiWRAdS/T+4P67QA78gZ+kLTKpg+g8X+8Adoi6BBHmGv1p4Z+6x3 YBzQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=SkeA9963fvICt6ND8XDfTgGy1x/kapYUXHTh6Eheow4=; b=LvaP21qRqkxTNi664prrdGX6JebANeSkqdpPixd3mQDwAVEBtyJ4rR/YydCvlvUHgf 7Gt4czR/wHpySTChBJ1fIB/EyWBOZj5Ha2dVxgiLn6rziEAYR9zpO6Y4/PWeLKYsEPPS 0V6YDvXuftR0E6DnuiSCKG2f4/YcRDjpbpo/weuZh2Ea8oOSUWcQ2/9Jc3tq1kUq6yLE spxMCzI6UfapbbtfFI9zk08QX2M5r1n2eS3K7G24ySDa8clGdlvI/50Oz5H+31NixTRA QGUzZF4qNFnPMZhQ7sfdwm79MNkPWUaqVmE5QsOq8xiKNK7CXjrdFAiKSa98CWMWiw08 67VQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@redhat.com header.s=mimecast20190719 header.b="btYhsm/n"; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id b9si4551185vsr.22.2021.08.10.05.22.56 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 10 Aug 2021 05:22:56 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=fail header.i=@redhat.com header.s=mimecast20190719 header.b="btYhsm/n"; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from localhost ([::1]:51012 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mDQmV-0005S8-Sd for patch@linaro.org; Tue, 10 Aug 2021 08:22:55 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:54436) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mDQie-0005sY-Ek for qemu-devel@nongnu.org; Tue, 10 Aug 2021 08:18:56 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:51213) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mDQid-0008VL-2M for qemu-devel@nongnu.org; Tue, 10 Aug 2021 08:18:56 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1628597934; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=SkeA9963fvICt6ND8XDfTgGy1x/kapYUXHTh6Eheow4=; b=btYhsm/nK7dUKozDIVB8LumtD0r5e2fcH03UuDpqdMM7jzlK1Bg4k/9Q3ABidLrbLgXYp9 EaIejLOy3kdvPPaXRabnA1LHwFXuRxK9JuIAz6Ik6v31zJ8u9AYjYha8xTiCZywFqQ8yGI fazCqdGEWU2vqDAmNDFcM+tHjGMbZCo= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-292-fFe_qDwBOyms_CrlpXZG8Q-1; Tue, 10 Aug 2021 08:18:52 -0400 X-MC-Unique: fFe_qDwBOyms_CrlpXZG8Q-1 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 20F90107B7C8; Tue, 10 Aug 2021 12:18:52 +0000 (UTC) Received: from sirius.home.kraxel.org (unknown [10.39.193.3]) by smtp.corp.redhat.com (Postfix) with ESMTPS id D1DF581F73; Tue, 10 Aug 2021 12:18:51 +0000 (UTC) Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id 2831A180092B; Tue, 10 Aug 2021 14:18:40 +0200 (CEST) From: Gerd Hoffmann To: qemu-devel@nongnu.org Subject: [PULL 3/3] ui/sdl2: Check return value from g_setenv() Date: Tue, 10 Aug 2021 14:18:39 +0200 Message-Id: <20210810121840.2525726-4-kraxel@redhat.com> In-Reply-To: <20210810121840.2525726-1-kraxel@redhat.com> References: <20210810121840.2525726-1-kraxel@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=kraxel@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Received-SPF: pass client-ip=170.10.133.124; envelope-from=kraxel@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -34 X-Spam_score: -3.5 X-Spam_bar: --- X-Spam_report: (-3.5 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.704, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell , Gerd Hoffmann Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Peter Maydell Setting environment variables can fail; check the return value from g_setenv() and bail out if we couldn't set SDL_VIDEODRIVER. Fixes: Coverity 1458798 Signed-off-by: Peter Maydell Message-Id: <20210809161424.32355-1-peter.maydell@linaro.org> Signed-off-by: Gerd Hoffmann --- ui/sdl2.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) -- 2.31.1 diff --git a/ui/sdl2.c b/ui/sdl2.c index 36d9010cb6c1..17c0ec30ebff 100644 --- a/ui/sdl2.c +++ b/ui/sdl2.c @@ -817,7 +817,10 @@ static void sdl2_display_init(DisplayState *ds, DisplayOptions *o) * This is a bit hackish but saves us from bigger problem. * Maybe it's a good idea to fix this in SDL instead. */ - g_setenv("SDL_VIDEODRIVER", "x11", 0); + if (!g_setenv("SDL_VIDEODRIVER", "x11", 0)) { + fprintf(stderr, "Could not set SDL_VIDEODRIVER environment variable\n"); + exit(1); + } #endif if (SDL_Init(SDL_INIT_VIDEO)) {