Skip to content

Commit 4dee96f

Browse files
Andy GroverNicholas Bellinger
authored andcommitted
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: Andy Grover <agrover@redhat.com> Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
1 parent 4e529be commit 4dee96f

1 file changed

Lines changed: 4 additions & 5 deletions

File tree

‎drivers/target/target_core_pr.c‎

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1932,13 +1932,13 @@ static int core_scsi3_update_aptpl_buf(
19321932
*/
19331933
static int __core_scsi3_write_aptpl_to_file(
19341934
struct se_device *dev,
1935-
unsigned char *buf,
1936-
u32 pr_aptpl_buf_len)
1935+
unsigned char *buf)
19371936
{
19381937
struct t10_wwn *wwn = &dev->t10_wwn;
19391938
struct file *file;
19401939
int flags = O_RDWR | O_CREAT | O_TRUNC;
19411940
char path[512];
1941+
u32 pr_aptpl_buf_len;
19421942
int ret;
19431943

19441944
memset(path, 0, 512);
@@ -1957,8 +1957,7 @@ static int __core_scsi3_write_aptpl_to_file(
19571957
return PTR_ERR(file);
19581958
}
19591959

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

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

@@ -1993,7 +1992,7 @@ core_scsi3_update_and_write_aptpl(struct se_device *dev, unsigned char *in_buf,
19931992
* __core_scsi3_write_aptpl_to_file() will call strlen()
19941993
* on the passed buf to determine pr_aptpl_buf_len.
19951994
*/
1996-
return __core_scsi3_write_aptpl_to_file(dev, buf, 0);
1995+
return __core_scsi3_write_aptpl_to_file(dev, buf);
19971996
}
19981997

19991998
static sense_reason_t

0 commit comments

Comments
 (0)