You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
static long rpmsg_sdb_decode_rxbuf_string(char *rxbuf_str, int *buffer_id, size_t *size)
{
int ret = 0;
char *sub_str;
long bsize;
long bufid;
const char delimiter[1] = {'L'};
//pr_err("%s: rxbuf_str:%s\n", __func__, rxbuf_str);
/* Get first part containing the buffer id */
sub_str = strsep(&rxbuf_str, delimiter);
//pr_err("%s: sub_str:%s\n", __func__, sub_str);
/* Save Buffer id and size: template BxLyyyyyyyy*/
ret = kstrtol(&sub_str[1], 10, &bufid);
if (ret < 0) {
pr_err("%s: extract of buffer id failed(%d)", __func__, ret);
goto out;
}
ret = kstrtol(rxbuf_str, 16, &bsize);
if (ret < 0) {
pr_err("%s: extract of buffer size failed(%d)", __func__, ret);
goto out;
}
*size = (size_t)bsize;
*buffer_id = (int)bufid;
out:
return ret;
}
The text was updated successfully, but these errors were encountered:
strsep will change value of rxbuf_str
so, the right is below
static long rpmsg_sdb_decode_rxbuf_string(char *rxbuf_str, int *buffer_id, size_t *size)
{
int ret = 0;
char *sub_str;
long bsize;
long bufid;
const char delimiter[1] = {'L'};
out:
return ret;
}
The text was updated successfully, but these errors were encountered: