Skip to content

Commit 4f4c337

Browse files
Fabian Fredericktorvalds
authored andcommitted
fs/dlm/config.c: convert simple_str to kstr
Replace obsolete functions simple_strtoul/kstrtouint simple_strtol/kstrtoint (kstr __must_check requires the right function to be applied) Signed-off-by: Fabian Frederick <[email protected]> Cc: Christine Caulfield <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
1 parent 33041a0 commit 4f4c337

File tree

1 file changed

+20
-6
lines changed

1 file changed

+20
-6
lines changed

fs/dlm/config.c

Lines changed: 20 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -157,11 +157,13 @@ static ssize_t cluster_set(struct dlm_cluster *cl, unsigned int *cl_field,
157157
const char *buf, size_t len)
158158
{
159159
unsigned int x;
160+
int rc;
160161

161162
if (!capable(CAP_SYS_ADMIN))
162163
return -EPERM;
163-
164-
x = simple_strtoul(buf, NULL, 0);
164+
rc = kstrtouint(buf, 0, &x);
165+
if (rc)
166+
return rc;
165167

166168
if (check_zero && !x)
167169
return -EINVAL;
@@ -730,7 +732,10 @@ static ssize_t comm_nodeid_read(struct dlm_comm *cm, char *buf)
730732
static ssize_t comm_nodeid_write(struct dlm_comm *cm, const char *buf,
731733
size_t len)
732734
{
733-
cm->nodeid = simple_strtol(buf, NULL, 0);
735+
int rc = kstrtoint(buf, 0, &cm->nodeid);
736+
737+
if (rc)
738+
return rc;
734739
return len;
735740
}
736741

@@ -742,7 +747,10 @@ static ssize_t comm_local_read(struct dlm_comm *cm, char *buf)
742747
static ssize_t comm_local_write(struct dlm_comm *cm, const char *buf,
743748
size_t len)
744749
{
745-
cm->local= simple_strtol(buf, NULL, 0);
750+
int rc = kstrtoint(buf, 0, &cm->local);
751+
752+
if (rc)
753+
return rc;
746754
if (cm->local && !local_comm)
747755
local_comm = cm;
748756
return len;
@@ -846,7 +854,10 @@ static ssize_t node_nodeid_write(struct dlm_node *nd, const char *buf,
846854
size_t len)
847855
{
848856
uint32_t seq = 0;
849-
nd->nodeid = simple_strtol(buf, NULL, 0);
857+
int rc = kstrtoint(buf, 0, &nd->nodeid);
858+
859+
if (rc)
860+
return rc;
850861
dlm_comm_seq(nd->nodeid, &seq);
851862
nd->comm_seq = seq;
852863
return len;
@@ -860,7 +871,10 @@ static ssize_t node_weight_read(struct dlm_node *nd, char *buf)
860871
static ssize_t node_weight_write(struct dlm_node *nd, const char *buf,
861872
size_t len)
862873
{
863-
nd->weight = simple_strtol(buf, NULL, 0);
874+
int rc = kstrtoint(buf, 0, &nd->weight);
875+
876+
if (rc)
877+
return rc;
864878
return len;
865879
}
866880

0 commit comments

Comments
 (0)