#4556 closed defect (fixed)

rtems_shell_main_mmove problem

Reported by: chenjin_zhong Owned by: Chris Johns
Priority: normal Milestone: 6.1
Component: shell Version: 6
Severity: normal Keywords:
Cc: Blocked By:
Blocking:

Description

Hi, I think mmove command in shell means that the memory can be overlapped when copy happens. but I find that when implementing this function, the memcpy is used in RTEMS4.13/RTEMS5.1.Should the memcpy be replaced with memmove ? The src code is listed as follows.
static int rtems_shell_main_mmove(

int argc,
char *argv[]

)
{

unsigned long tmp;
void *src;
void *dst;
size_t length;

if ( argc < 4 ) {

fprintf(stderr,"%s: too few arguments\n", argv[0]);
return -1;

}

/*

  • Convert arguments into numbers */

if ( rtems_string_to_pointer(argv[1], &dst, NULL) ) {

printf( "Destination argument (%s) is not a number\n", argv[1] );
return -1;

}

if ( rtems_string_to_pointer(argv[2], &src, NULL) ) {

printf( "Source argument (%s) is not a number\n", argv[2] );
return -1;

}

if ( rtems_string_to_unsigned_long(argv[3], &tmp, NULL, 0) ) {

printf( "Length argument (%s) is not a number\n", argv[3] );
return -1;

}
length = (size_t) tmp;

/*

  • Now copy the memory. */

memcpy(dst, src, length);

return 0;

}

Change History (3)

comment:1 Changed on 11/10/22 at 00:44:36 by Chris Johns

Milestone: 5.16.1
Version: 56

comment:2 Changed on 11/29/22 at 23:49:11 by Chris Johns

Owner: set to Chris Johns
Status: newassigned

comment:3 Changed on 12/23/22 at 18:56:38 by zack leung <zakthertemsdev@…>

Resolution: fixed
Status: assignedclosed

In 4523c713/rtems:

rtems_shell_main_mmove problem

--0000000000006acec205efd38cd6
Content-Type: text/plain; charset="UTF-8"

Closes #4556

Note: See TracTickets for help on using tickets.