From patchwork Thu Jul 7 08:01:12 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jan Beulich X-Patchwork-Id: 9218099 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 720626048B for ; Thu, 7 Jul 2016 08:01:17 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 673052879B for ; Thu, 7 Jul 2016 08:01:17 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 5BB652879E; Thu, 7 Jul 2016 08:01:17 +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=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 163DC2879B for ; Thu, 7 Jul 2016 08:01:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756678AbcGGIBO (ORCPT ); Thu, 7 Jul 2016 04:01:14 -0400 Received: from prv-mh.provo.novell.com ([137.65.248.74]:36695 "EHLO prv-mh.provo.novell.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756526AbcGGIBN convert rfc822-to-8bit (ORCPT ); Thu, 7 Jul 2016 04:01:13 -0400 Received: from INET-PRV-MTA by prv-mh.provo.novell.com with Novell_GroupWise; Thu, 07 Jul 2016 02:01:12 -0600 Message-Id: <577E286802000078000FBECF@prv-mh.provo.novell.com> X-Mailer: Novell GroupWise Internet Agent 14.2.0 Date: Thu, 07 Jul 2016 02:01:12 -0600 From: "Jan Beulich" To: "Juergen Gross" Cc: , Subject: [PATCH] xen-scsiback: correct return value checks on xenbus_scanf() Mime-Version: 1.0 Content-Disposition: inline Sender: linux-scsi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Only a positive return value indicates success. Signed-off-by: Jan Beulich --- drivers/xen/xen-scsiback.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) -- To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html --- 4.7-rc6-xenbus_scanf.orig/drivers/xen/xen-scsiback.c +++ 4.7-rc6-xenbus_scanf/drivers/xen/xen-scsiback.c @@ -1071,7 +1071,7 @@ static void scsiback_do_1lun_hotplug(str /* read status */ snprintf(state, sizeof(state), "vscsi-devs/%s/state", ent); err = xenbus_scanf(XBT_NIL, dev->nodename, state, "%u", &device_state); - if (XENBUS_EXIST_ERR(err)) + if (err <= 0) return; /* physical SCSI device */ @@ -1089,7 +1089,7 @@ static void scsiback_do_1lun_hotplug(str snprintf(str, sizeof(str), "vscsi-devs/%s/v-dev", ent); err = xenbus_scanf(XBT_NIL, dev->nodename, str, "%u:%u:%u:%u", &vir.hst, &vir.chn, &vir.tgt, &vir.lun); - if (XENBUS_EXIST_ERR(err)) { + if (err != 4) { xenbus_printf(XBT_NIL, dev->nodename, state, "%d", XenbusStateClosed); return;