Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

ocfs2: replace simple_strtol with kstrtol

kstrtol() is better because simple_strtol() ignores overflow. And using
kstrtol() is more concise.

Link: https://lkml.kernel.org/r/20250527092333.1917391-1-suhui@nfschina.com
Signed-off-by: Su Hui <suhui@nfschina.com>
Reviewed-by: Joseph Qi <joseph.qi@linux.alibaba.com>
Cc: Mark Fasheh <mark@fasheh.com>
Cc: Joel Becker <jlbec@evilplan.org>
Cc: Junxiao Bi <junxiao.bi@oracle.com>
Cc: Changwei Ge <gechangwei@live.cn>
Cc: Jun Piao <piaojun@huawei.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>

authored by

Su Hui and committed by
Andrew Morton
85df0d50 50b4233a

+4 -11
+4 -11
fs/ocfs2/stack_user.c
··· 360 360 struct ocfs2_control_message_setn *msg) 361 361 { 362 362 long nodenum; 363 - char *ptr = NULL; 364 363 struct ocfs2_control_private *p = file->private_data; 365 364 366 365 if (ocfs2_control_get_handshake_state(file) != ··· 374 375 return -EINVAL; 375 376 msg->space = msg->newline = '\0'; 376 377 377 - nodenum = simple_strtol(msg->nodestr, &ptr, 16); 378 - if (!ptr || *ptr) 378 + if (kstrtol(msg->nodestr, 16, &nodenum)) 379 379 return -EINVAL; 380 380 381 381 if ((nodenum == LONG_MIN) || (nodenum == LONG_MAX) || ··· 389 391 struct ocfs2_control_message_setv *msg) 390 392 { 391 393 long major, minor; 392 - char *ptr = NULL; 393 394 struct ocfs2_control_private *p = file->private_data; 394 395 struct ocfs2_protocol_version *max = 395 396 &ocfs2_user_plugin.sp_max_proto; ··· 406 409 return -EINVAL; 407 410 msg->space1 = msg->space2 = msg->newline = '\0'; 408 411 409 - major = simple_strtol(msg->major, &ptr, 16); 410 - if (!ptr || *ptr) 412 + if (kstrtol(msg->major, 16, &major)) 411 413 return -EINVAL; 412 - minor = simple_strtol(msg->minor, &ptr, 16); 413 - if (!ptr || *ptr) 414 + if (kstrtol(msg->minor, 16, &minor)) 414 415 return -EINVAL; 415 416 416 417 /* ··· 436 441 struct ocfs2_control_message_down *msg) 437 442 { 438 443 long nodenum; 439 - char *p = NULL; 440 444 441 445 if (ocfs2_control_get_handshake_state(file) != 442 446 OCFS2_CONTROL_HANDSHAKE_VALID) ··· 450 456 return -EINVAL; 451 457 msg->space1 = msg->space2 = msg->newline = '\0'; 452 458 453 - nodenum = simple_strtol(msg->nodestr, &p, 16); 454 - if (!p || *p) 459 + if (kstrtol(msg->nodestr, 16, &nodenum)) 455 460 return -EINVAL; 456 461 457 462 if ((nodenum == LONG_MIN) || (nodenum == LONG_MAX) ||