mirror of
https://github.com/SCST-project/scst.git
synced 2026-07-19 14:32:30 +00:00
Fix a few minor "extra" compiler warnings (mostly "const" issues)
Add "XXX" comments in a few places about potential problems seen in SCST code, for future investigation and possible repair. Signed-off-by: David Butterfield <dab21774@gmail.com> git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@7123 d57e44dd-8a1f-0410-8b47-8ef2f437770f
This commit is contained in:
@@ -509,6 +509,11 @@ void cmnd_done(struct iscsi_cmnd *cmnd)
|
||||
if (cmnd->sg != &dummy_sg)
|
||||
scst_free_sg(cmnd->sg, cmnd->sg_cnt);
|
||||
#ifdef CONFIG_SCST_DEBUG
|
||||
/*
|
||||
* We can make correct behavior depend on this, so
|
||||
* a bug can disappear whenever you enable debugging,
|
||||
* but probability of failure on zero/NULL is much bigger
|
||||
*/
|
||||
cmnd->own_sg = 0;
|
||||
cmnd->sg = NULL;
|
||||
cmnd->sg_cnt = -1;
|
||||
@@ -2911,7 +2916,7 @@ out:
|
||||
return;
|
||||
}
|
||||
|
||||
static void set_cork(struct socket *sock, int on)
|
||||
static inline void set_cork(struct socket *sock, int on)
|
||||
{
|
||||
int opt = on;
|
||||
mm_segment_t oldfs;
|
||||
|
||||
@@ -1687,7 +1687,7 @@ static int tx_padding(struct iscsi_cmnd *cmnd, int state)
|
||||
int res, rest = cmnd->conn->write_size;
|
||||
struct msghdr msg = {.msg_flags = MSG_NOSIGNAL | MSG_DONTWAIT};
|
||||
struct kvec iov;
|
||||
static uint32_t padding;
|
||||
static const uint32_t padding;
|
||||
|
||||
BUG_ON(rest < 1);
|
||||
BUG_ON(rest >= sizeof(uint32_t));
|
||||
|
||||
@@ -105,6 +105,9 @@ static u8 decode_base64_digit(char base64)
|
||||
else if ((base64 >= '0') && (base64 <= '9'))
|
||||
return 52 + (base64 - '0');
|
||||
else
|
||||
//XXX This return value should be unsigned; and anyway
|
||||
//XXX in case of a bad character in the string, our
|
||||
//XXX caller (sometimes) checks for 65, not 255 or -1
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
@@ -146,6 +149,8 @@ static void decode_base64_string(char *string, u8 *intnum, int int_len)
|
||||
num[1] = decode_base64_digit(string[count + 1]);
|
||||
num[2] = decode_base64_digit(string[count + 2]);
|
||||
num[3] = decode_base64_digit(string[count + 3]);
|
||||
//XXX Check for the special "bad character in string" value here like above?
|
||||
//XXX Also check the string for missing/incorrect padding?
|
||||
if ((num[0] == 64) || (num[1] == 64))
|
||||
return;
|
||||
if (num[2] == 64) {
|
||||
|
||||
@@ -1144,7 +1144,7 @@ int config_load(const char *config_name)
|
||||
|
||||
err = config_isns_load(buf);
|
||||
if ((err == 0) && (isns_server != NULL)) {
|
||||
int rc = isns_init();
|
||||
rc = isns_init();
|
||||
|
||||
if (rc != 0) {
|
||||
log_error("iSNS server %s init failed: %d", isns_server, rc);
|
||||
|
||||
+2
-2
@@ -4081,8 +4081,8 @@ static inline enum scst_exec_context __scst_estimate_context(bool atomic)
|
||||
else if (in_atomic())
|
||||
return SCST_CONTEXT_DIRECT_ATOMIC;
|
||||
else
|
||||
return atomic ? SCST_CONTEXT_DIRECT :
|
||||
SCST_CONTEXT_DIRECT_ATOMIC;
|
||||
return atomic ? SCST_CONTEXT_DIRECT_ATOMIC :
|
||||
SCST_CONTEXT_DIRECT;
|
||||
#else
|
||||
return SCST_CONTEXT_THREAD;
|
||||
#endif
|
||||
|
||||
@@ -83,7 +83,7 @@ static struct scst_trace_log vdisk_local_trace_tbl[] = {
|
||||
#define SCST_FIO_VENDOR "SCST_FIO"
|
||||
#define SCST_BIO_VENDOR "SCST_BIO"
|
||||
/* 4 byte ASCII Product Revision Level - left aligned */
|
||||
#define SCST_FIO_REV " 330"
|
||||
#define SCST_FIO_REV "330 "
|
||||
|
||||
#define MAX_USN_LEN (20+1) /* For '\0' */
|
||||
#define MAX_INQ_VEND_SPECIFIC_LEN (INQ_BUF_SZ - 96)
|
||||
@@ -2081,8 +2081,11 @@ static int vdisk_format_dif(struct scst_cmd *cmd, uint64_t start_lba,
|
||||
goto out_set_fs;
|
||||
} else if (err < full_len) {
|
||||
/*
|
||||
* Probably that's wrong, but sometimes write() returns
|
||||
* value less, than requested. Let's restart.
|
||||
* If a write() is interrupted by a signal handler before
|
||||
* any bytes are written, then the call fails with the
|
||||
* error EINTR; if it is interrupted after at least one
|
||||
* byte has been written, the call succeeds, and returns
|
||||
* the number of bytes written -- manpage write(2)
|
||||
*/
|
||||
left += full_len - err;
|
||||
done -= full_len - err;
|
||||
|
||||
+7
-7
@@ -11695,15 +11695,15 @@ uint64_t scst_unpack_lun(const uint8_t *lun, int len)
|
||||
case 2:
|
||||
break;
|
||||
case 8:
|
||||
if ((*((__be64 *)lun) & cpu_to_be64(0x0000FFFFFFFFFFFFLL)) != 0)
|
||||
if ((*((__be64 const *)lun) & cpu_to_be64(0x0000FFFFFFFFFFFFLL)) != 0)
|
||||
goto out_err;
|
||||
break;
|
||||
case 4:
|
||||
if (*((__be16 *)&lun[2]) != 0)
|
||||
if (*((__be16 const *)&lun[2]) != 0)
|
||||
goto out_err;
|
||||
break;
|
||||
case 6:
|
||||
if (*((__be32 *)&lun[2]) != 0)
|
||||
if (*((__be32 const *)&lun[2]) != 0)
|
||||
goto out_err;
|
||||
break;
|
||||
case 1:
|
||||
@@ -13870,10 +13870,10 @@ EXPORT_SYMBOL(scst_reassign_retained_sess_states);
|
||||
char *scst_get_next_lexem(char **token_str)
|
||||
{
|
||||
char *p, *q;
|
||||
static const char blank = '\0';
|
||||
static char blank = '\0';
|
||||
|
||||
if ((token_str == NULL) || (*token_str == NULL))
|
||||
return (char *)␣
|
||||
return ␣
|
||||
|
||||
for (p = *token_str; (*p != '\0') && (isspace(*p) || (*p == '=')); p++)
|
||||
;
|
||||
@@ -14874,7 +14874,7 @@ int scst_write_file_transactional(const char *name, const char *name1,
|
||||
|
||||
pos = signature_len+1;
|
||||
|
||||
res = vfs_write(file, (void __force __user *)buf, size, &pos);
|
||||
res = vfs_write(file, (void const __force __user *)buf, size, &pos);
|
||||
if (res != size)
|
||||
goto write_error;
|
||||
|
||||
@@ -14885,7 +14885,7 @@ int scst_write_file_transactional(const char *name, const char *name1,
|
||||
}
|
||||
|
||||
pos = 0;
|
||||
res = vfs_write(file, (void __force __user *)signature, signature_len, &pos);
|
||||
res = vfs_write(file, (void const __force __user *)signature, signature_len, &pos);
|
||||
if (res != signature_len)
|
||||
goto write_error;
|
||||
|
||||
|
||||
@@ -1552,9 +1552,13 @@ static int scst_prepare_space(struct scst_cmd *cmd)
|
||||
goto alloc;
|
||||
else if (r == 0) {
|
||||
if (unlikely(cmd->bufflen == 0)) {
|
||||
/* See comment in scst_alloc_space() */
|
||||
if (cmd->sg == NULL)
|
||||
if (cmd->sg == NULL) {
|
||||
/*
|
||||
* Let's still have a buffer for uniformity,
|
||||
* scst_alloc_space() will handle bufflen 0
|
||||
*/
|
||||
goto alloc;
|
||||
}
|
||||
}
|
||||
|
||||
cmd->tgt_i_data_buf_alloced = 1;
|
||||
|
||||
+1
-1
@@ -30,7 +30,7 @@
|
||||
/* 8 byte ASCII Vendor */
|
||||
#define VENDOR "SCST_USR"
|
||||
/* 4 byte ASCII Product Revision Level - left aligned */
|
||||
#define FIO_REV " 330"
|
||||
#define FIO_REV "330 "
|
||||
|
||||
#define MAX_USN_LEN (20+1) /* For '\0' */
|
||||
|
||||
|
||||
Reference in New Issue
Block a user