From 3f523fa34ffe73073d8d895f386afbae65c83d97 Mon Sep 17 00:00:00 2001 From: Vladislav Bolkhovitin Date: Sat, 14 Jun 2014 00:31:55 +0000 Subject: [PATCH] Merged revisions 5602 via svnmerge from svn+ssh://vlnb@svn.code.sf.net/p/scst/svn/trunk ........ r5602 | vlnb | 2014-06-13 16:57:26 -0700 (Fri, 13 Jun 2014) | 8 lines scst_pr_read_reservation(): Initialize returned buffer Avoid that this function returns an uninitialized buffer to the initiator if buffer_size < 8. Detected by Coverity. Signed-off-by: Bart Van Assche ........ git-svn-id: http://svn.code.sf.net/p/scst/svn/branches/3.0.x@5604 d57e44dd-8a1f-0410-8b47-8ef2f437770f --- scst/src/scst_pres.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/scst/src/scst_pres.c b/scst/src/scst_pres.c index c20edd010..9e7dbb1d9 100644 --- a/scst/src/scst_pres.c +++ b/scst/src/scst_pres.c @@ -2566,7 +2566,7 @@ void scst_pr_read_reservation(struct scst_cmd *cmd, uint8_t *buffer, int buffer_size) { struct scst_device *dev = cmd->dev; - uint8_t b[24]; + uint8_t b[24] = { }; int size = 0; TRACE_ENTRY(); @@ -2579,8 +2579,6 @@ void scst_pr_read_reservation(struct scst_cmd *cmd, uint8_t *buffer, goto out; } - memset(b, 0, sizeof(b)); - put_unaligned_be32(dev->pr_generation, &b[0]); if (!dev->pr_is_set) {