pr.c (c34e9ab9a612ee8b18273398ef75c207b01f516d) | pr.c (41d826c8a9de37af5d1710a37b55720bd5ad8709) |
---|---|
1// SPDX-License-Identifier: GPL-2.0 2/* 3 * NVMe over Fabrics Persist Reservation. 4 * Copyright (c) 2024 Guixin Liu, Alibaba Group. 5 * All rights reserved. 6 */ 7#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt 8#include <linux/unaligned.h> --- 814 unchanged lines hidden (view full) --- 823 } 824 825 if (num_bytes < sizeof(struct nvme_reservation_status_ext)) { 826 req->error_loc = offsetof(struct nvme_common_command, cdw10); 827 status = NVME_SC_INVALID_FIELD | NVME_STATUS_DNR; 828 goto out; 829 } 830 | 1// SPDX-License-Identifier: GPL-2.0 2/* 3 * NVMe over Fabrics Persist Reservation. 4 * Copyright (c) 2024 Guixin Liu, Alibaba Group. 5 * All rights reserved. 6 */ 7#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt 8#include <linux/unaligned.h> --- 814 unchanged lines hidden (view full) --- 823 } 824 825 if (num_bytes < sizeof(struct nvme_reservation_status_ext)) { 826 req->error_loc = offsetof(struct nvme_common_command, cdw10); 827 status = NVME_SC_INVALID_FIELD | NVME_STATUS_DNR; 828 goto out; 829 } 830 |
831 data = kmalloc(num_bytes, GFP_KERNEL); | 831 data = kzalloc(num_bytes, GFP_KERNEL); |
832 if (!data) { 833 status = NVME_SC_INTERNAL; 834 goto out; 835 } | 832 if (!data) { 833 status = NVME_SC_INTERNAL; 834 goto out; 835 } |
836 memset(data, 0, num_bytes); | |
837 data->gen = cpu_to_le32(atomic_read(&pr->generation)); 838 data->ptpls = 0; 839 ctrl_eds = data->regctl_eds; 840 841 rcu_read_lock(); 842 holder = rcu_dereference(pr->holder); 843 rtype = holder ? holder->rtype : 0; 844 data->rtype = rtype; --- 312 unchanged lines hidden --- | 836 data->gen = cpu_to_le32(atomic_read(&pr->generation)); 837 data->ptpls = 0; 838 ctrl_eds = data->regctl_eds; 839 840 rcu_read_lock(); 841 holder = rcu_dereference(pr->holder); 842 rtype = holder ? holder->rtype : 0; 843 data->rtype = rtype; --- 312 unchanged lines hidden --- |