From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-0.8 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1A0BFC433DF for ; Fri, 12 Jun 2020 16:54:05 +0000 (UTC) Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id E24AD20801 for ; Fri, 12 Jun 2020 16:54:04 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org E24AD20801 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=citrix.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=xen-devel-bounces@lists.xenproject.org Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1jjmw9-0004cg-PZ; Fri, 12 Jun 2020 16:53:49 +0000 Received: from all-amaz-eas1.inumbo.com ([34.197.232.57] helo=us1-amaz-eas2.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1jjmw8-0004cY-NW for xen-devel@lists.xenproject.org; Fri, 12 Jun 2020 16:53:48 +0000 X-Inumbo-ID: 48853082-accd-11ea-b5f2-12813bfff9fa Received: from esa2.hc3370-68.iphmx.com (unknown [216.71.145.153]) by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS id 48853082-accd-11ea-b5f2-12813bfff9fa; Fri, 12 Jun 2020 16:53:47 +0000 (UTC) Authentication-Results: esa2.hc3370-68.iphmx.com; dkim=none (message not signed) header.i=none IronPort-SDR: pxFI2Da+eeTPtFqwFes9rTX92L1uHDhEzTJhKZUPNOFGvUW44xplGVm3YoYIW88itrNhiwgrAY ORcduGCSEIWR9SWG/WBujgFl0Zoi/7p3eeYPePM2nPsQNFBTMvY1XDi/WnapFfoFwM+nIA+kKS BIq4K8V8wZHQGrY3dhPx389YHu6ugsaDl9w/hHr22hYTiJcM/frYmv7uoHIOiJ1xax+SaWSsRM p73HGeynEYCjgUxepli+t6JbTGowjtW53a3OFBQtOXzIPYxZjhCcWjlMXJXvy82h86AfihBQ9E jos= X-SBRS: 2.7 X-MesageID: 19939533 X-Ironport-Server: esa2.hc3370-68.iphmx.com X-Remote-IP: 162.221.158.21 X-Policy: $RELAYED X-IronPort-AV: E=Sophos;i="5.73,504,1583211600"; d="scan'208";a="19939533" From: Ian Jackson MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Message-ID: <24291.45845.782250.165305@mariner.uk.xensource.com> Date: Fri, 12 Jun 2020 17:53:41 +0100 To: Igor Druzhinin Subject: Re: [XEN PATCH for-4.14] tools/xen-ucode: fix error code propagation of microcode load operation In-Reply-To: <1591980255-18811-1-git-send-email-igor.druzhinin@citrix.com> References: <1591980255-18811-1-git-send-email-igor.druzhinin@citrix.com> X-Mailer: VM 8.2.0b under 24.5.1 (i686-pc-linux-gnu) X-BeenThere: xen-devel@lists.xenproject.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Cc: "xen-devel@lists.xenproject.org" , Paul Durrant , "wl@xen.org" , Andrew Cooper Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" Igor Druzhinin writes ("[PATCH] tools/xen-ucode: fix error code propagation of microcode load operation"): > Otherwise it's impossible to know the reason for a fault or blob rejection > inside the automation. ... > fprintf(stderr, "Failed to update microcode. (err: %s)\n", > strerror(errno)); This part is fine. > + ret = errno; > xc_interface_close(xch); ... > } > close(fd); > > - return 0; > + return ret; Unfortunately I don't think this is right. errno might not fit into a return value. Returning nonzero on microcode loading error would definitely be right, but ... ... oh I have just read the rest of this file. I think what is missing here is simply `return errno' (and the braces) There is no need to call xc_interface_close, or munmap, if we are about to exit. I think fixing the lost error return is 4.14 material, so I have added that to the subject line. Paul, would you Release-ack a patch that replaced every `return errno' with (say) exit(12) ? Otherwise, fixing this program not to try to fit errno into an exit status is future work. Also I notice that the program exits 0 if invoked wrongly. Unhelpful! I would want to fix that too. Ian.