Skip to content

Commit

Permalink
target: Remove unneeded param pr_aptpl_buf_len to write_aptpl_to_file()
Browse files Browse the repository at this point in the history
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: Andy Grover <agrover@redhat.com>
Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
  • Loading branch information
Andy Grover authored and Nicholas Bellinger committed Jun 14, 2013
1 parent 4e529be commit 4dee96f
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions drivers/target/target_core_pr.c
Original file line number Diff line number Diff line change
Expand Up @@ -1932,13 +1932,13 @@ static int core_scsi3_update_aptpl_buf(
*/
static int __core_scsi3_write_aptpl_to_file(
struct se_device *dev,
unsigned char *buf,
u32 pr_aptpl_buf_len)
unsigned char *buf)
{
struct t10_wwn *wwn = &dev->t10_wwn;
struct file *file;
int flags = O_RDWR | O_CREAT | O_TRUNC;
char path[512];
u32 pr_aptpl_buf_len;
int ret;

memset(path, 0, 512);
Expand All @@ -1957,8 +1957,7 @@ static int __core_scsi3_write_aptpl_to_file(
return PTR_ERR(file);
}

if (!pr_aptpl_buf_len)
pr_aptpl_buf_len = (strlen(&buf[0]) + 1); /* Add extra for NULL */
pr_aptpl_buf_len = (strlen(buf) + 1); /* Add extra for NULL */

ret = kernel_write(file, buf, pr_aptpl_buf_len, 0);

Expand Down Expand Up @@ -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()
* 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
Expand Down

0 comments on commit 4dee96f

Please sign in to comment.