This is correct.
An example of a risk factor for cancer could be very unhealthy food or a sedentary lifestyle.
Eating very unhealthy can pose a risk and increase the likelihood of you developing cancer at a certain stage in your life; it is considered to be a risk factor for that reason.