Commit 4dee96fb authored by Andy Grover's avatar Andy Grover Committed by Nicholas Bellinger

target: Remove unneeded param pr_aptpl_buf_len to write_aptpl_to_file()

As mentioned in the comments in update_and_write_aptpl,
write_aptpl_to_file() calls strlen() on the buffer, and the length was
always being passed as zero.
Signed-off-by: default avatarAndy Grover <agrover@redhat.com>
Signed-off-by: default avatarNicholas Bellinger <nab@linux-iscsi.org>
parent 4e529be2
...@@ -1932,13 +1932,13 @@ static int core_scsi3_update_aptpl_buf( ...@@ -1932,13 +1932,13 @@ static int core_scsi3_update_aptpl_buf(
*/ */
static int __core_scsi3_write_aptpl_to_file( static int __core_scsi3_write_aptpl_to_file(
struct se_device *dev, struct se_device *dev,
unsigned char *buf, unsigned char *buf)
u32 pr_aptpl_buf_len)
{ {
struct t10_wwn *wwn = &dev->t10_wwn; struct t10_wwn *wwn = &dev->t10_wwn;
struct file *file; struct file *file;
int flags = O_RDWR | O_CREAT | O_TRUNC; int flags = O_RDWR | O_CREAT | O_TRUNC;
char path[512]; char path[512];
u32 pr_aptpl_buf_len;
int ret; int ret;
memset(path, 0, 512); memset(path, 0, 512);
...@@ -1957,8 +1957,7 @@ static int __core_scsi3_write_aptpl_to_file( ...@@ -1957,8 +1957,7 @@ static int __core_scsi3_write_aptpl_to_file(
return PTR_ERR(file); return PTR_ERR(file);
} }
if (!pr_aptpl_buf_len) pr_aptpl_buf_len = (strlen(buf) + 1); /* Add extra for NULL */
pr_aptpl_buf_len = (strlen(&buf[0]) + 1); /* Add extra for NULL */
ret = kernel_write(file, buf, pr_aptpl_buf_len, 0); ret = kernel_write(file, buf, pr_aptpl_buf_len, 0);
...@@ -1993,7 +1992,7 @@ core_scsi3_update_and_write_aptpl(struct se_device *dev, unsigned char *in_buf, ...@@ -1993,7 +1992,7 @@ core_scsi3_update_and_write_aptpl(struct se_device *dev, unsigned char *in_buf,
* __core_scsi3_write_aptpl_to_file() will call strlen() * __core_scsi3_write_aptpl_to_file() will call strlen()
* on the passed buf to determine pr_aptpl_buf_len. * on the passed buf to determine pr_aptpl_buf_len.
*/ */
return __core_scsi3_write_aptpl_to_file(dev, buf, 0); return __core_scsi3_write_aptpl_to_file(dev, buf);
} }
static sense_reason_t static sense_reason_t
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment