Message ID | 1515756676-3860-3-git-send-email-pbonzini@redhat.com |
---|---|
State | New |
Headers | show
Return-Path: <qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org> X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=<UNKNOWN>) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="VeTNIjq1"; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3zJ0wB4NCxz9t3B for <incoming@patchwork.ozlabs.org>; Fri, 12 Jan 2018 22:32:26 +1100 (AEDT) Received: from localhost ([::1]:35178 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from <qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>) id 1eZxZQ-0007C5-H4 for incoming@patchwork.ozlabs.org; Fri, 12 Jan 2018 06:32:24 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:41371) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from <paolo.bonzini@gmail.com>) id 1eZxYU-00079O-Ml for qemu-devel@nongnu.org; Fri, 12 Jan 2018 06:31:27 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from <paolo.bonzini@gmail.com>) id 1eZxYR-0004E6-Nd for qemu-devel@nongnu.org; Fri, 12 Jan 2018 06:31:26 -0500 Received: from mail-wm0-x242.google.com ([2a00:1450:400c:c09::242]:36418) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from <paolo.bonzini@gmail.com>) id 1eZxYR-0004Ah-Hd for qemu-devel@nongnu.org; Fri, 12 Jan 2018 06:31:23 -0500 Received: by mail-wm0-x242.google.com with SMTP id b76so11240651wmg.1 for <qemu-devel@nongnu.org>; Fri, 12 Jan 2018 03:31:23 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:subject:date:message-id:in-reply-to:references; bh=Jt0Xhb4SuzYe0b5ia2LvO8eJ8oboIxs2Kr861nHZqow=; b=VeTNIjq168b7uHrgtA9af+hSib0uqdAfzUUfJI8hrHU1jfx25JLxR5Ge1bD0VBZ67k 4wkK6jVXQM+ziSiZgeXW4GizrcOmhLRkSJzmXAgKYuPdV6l/Ljn5LLlSoxsR72dBPeEt RnfnQmq2UW1IS2iqGMOJxnkCrYPnImZ/viBzwwkmkX+eupHv8w2Is2uE8beRhYrO5KUC soIOj2lEod2PAk8MaMq43PHadTxI0kCiwMmQ6dG7Xu90cCWmk0VQpKvHEUDBYWnoLDQ6 E+FpdHTzYaORY2RwRuDP8UB4wUN4XlM8kTpQwXD+LQ7TffM/Vhq68wsOGUCb998KFPy1 txPw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:subject:date:message-id :in-reply-to:references; bh=Jt0Xhb4SuzYe0b5ia2LvO8eJ8oboIxs2Kr861nHZqow=; b=Kp6ntGNHvonvf19WlZLYNeuLU9XQzKYpUXWeE1L4xC/bL4u0a2g43os06Zzh0e/WL4 tudwUUBvi8yGGwWgorrMy9usTu7QM8Az2blt7ftTHOu+ROLE+b/ylovGvEhGmI2Irpf+ lxMFs+kS83KZhxJEA6+LWCIFktAgT5sOvp0OPP2R4391a4wP1KXziChH47CNWJJ74CQF yog92SnQ8SPj6EOXSJeko25zorI2S+ROPihXvVtOAa2nxIArqZK5R3VZo4mwwUmOdPi+ +GOp/rYn7WJ/P/UIkLrns1xGTVc7f0U4rVxTIQGmciflCUWDbD7ZUJZl4mnSO60cRJRQ 2+Zg== X-Gm-Message-State: AKwxytfjzw4P7kN4h5iXRANtopgn5fq8h3TxBt4MvePHt4A84UbK2IJ1 9CRpJQDiSf6JZjLO/RVXUk2/wFk5 X-Google-Smtp-Source: ACJfBotH6pheHygNDAzOXazpv7hss2fzfvQW6spl4kbDKpcRSlHUb8A9ZHkQzRSJeu7MIqQMqYyW4Q== X-Received: by 10.28.224.137 with SMTP id x131mr4093285wmg.60.1515756682161; Fri, 12 Jan 2018 03:31:22 -0800 (PST) Received: from 640k.lan (dynamic-adsl-78-12-229-84.clienti.tiscali.it. [78.12.229.84]) by smtp.gmail.com with ESMTPSA id l8sm2732271wmg.46.2018.01.12.03.31.21 for <qemu-devel@nongnu.org> (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 12 Jan 2018 03:31:21 -0800 (PST) From: Paolo Bonzini <pbonzini@redhat.com> To: qemu-devel@nongnu.org Date: Fri, 12 Jan 2018 12:30:26 +0100 Message-Id: <1515756676-3860-3-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1515756676-3860-1-git-send-email-pbonzini@redhat.com> References: <1515756676-3860-1-git-send-email-pbonzini@redhat.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:400c:c09::242 Subject: [Qemu-devel] [PULL 02/52] scsi: fix scsi_convert_sense crash when in_buf == NULL && in_len == 0 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: <qemu-devel.nongnu.org> List-Unsubscribe: <https://lists.nongnu.org/mailman/options/qemu-devel>, <mailto:qemu-devel-request@nongnu.org?subject=unsubscribe> List-Archive: <http://lists.nongnu.org/archive/html/qemu-devel/> List-Post: <mailto:qemu-devel@nongnu.org> List-Help: <mailto:qemu-devel-request@nongnu.org?subject=help> List-Subscribe: <https://lists.nongnu.org/mailman/listinfo/qemu-devel>, <mailto:qemu-devel-request@nongnu.org?subject=subscribe> Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" <qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org> |
Series |
[PULL,01/52] scsi-generic: Add share-rw option
|
expand
|
diff --git a/scsi/utils.c b/scsi/utils.c index ddae650..8738522 100644 --- a/scsi/utils.c +++ b/scsi/utils.c @@ -322,18 +322,18 @@ int scsi_convert_sense(uint8_t *in_buf, int in_len, SCSISense sense; bool fixed_in; + if (in_len == 0) { + return scsi_build_sense_buf(buf, len, SENSE_CODE(NO_SENSE), fixed); + } + fixed_in = (in_buf[0] & 2) == 0; - if (in_len && fixed == fixed_in) { + if (fixed == fixed_in) { memcpy(buf, in_buf, MIN(len, in_len)); return MIN(len, in_len); - } - - if (in_len == 0) { - sense = SENSE_CODE(NO_SENSE); } else { sense = scsi_parse_sense_buf(in_buf, in_len); + return scsi_build_sense_buf(buf, len, sense, fixed); } - return scsi_build_sense_buf(buf, len, sense, fixed); } int scsi_sense_to_errno(int key, int asc, int ascq)