soc: handle invalid address passed to swrm_peek debugfs node
Add logic to handle invalid address passed to swrm_peek and swrm_poke debugfs node. Change-Id: I46443734e6b4b758276cdf8fd28a022d37112bfc Signed-off-by: Faiz Nabi Kuchay <quic_fkuchay@quicinc.com>
This commit is contained in:

committed by
Gerrit - the friendly Code Review server

parent
deeec3d073
commit
da3a17a06c
@@ -321,7 +321,7 @@ static ssize_t swrm_debug_peek_write(struct file *file, const char __user *ubuf,
|
||||
|
||||
lbuf[count] = '\0';
|
||||
rc = get_parameters(lbuf, param, 1);
|
||||
if ((param[0] <= SWRM_MAX_REGISTER) && (rc == 0))
|
||||
if ((param[0] <= SWRM_MAX_REGISTER) && (rc == 0) && (param[0] % 4 == 0))
|
||||
swrm->read_data = swr_master_read(swrm, param[0]);
|
||||
else
|
||||
rc = -EINVAL;
|
||||
@@ -360,7 +360,7 @@ static ssize_t swrm_debug_write(struct file *file,
|
||||
rc = get_parameters(lbuf, param, 2);
|
||||
if ((param[0] <= SWRM_MAX_REGISTER) &&
|
||||
(param[1] <= 0xFFFFFFFF) &&
|
||||
(rc == 0))
|
||||
(rc == 0) && (param[0] % 4 == 0))
|
||||
swr_master_write(swrm, param[0], param[1]);
|
||||
else
|
||||
rc = -EINVAL;
|
||||
|
Reference in New Issue
Block a user